I'm getting the error msg: "Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution."
Hi! Nice work you have done.
Can you help me?
I'm trying to make a Chrome extension just to remove non-numerical stuff from a prompt command input (from user).
My js file is
function ajustaCpf() {
var cpf = prompt("Cole aqui o CPF: ");
cpf.trim();
var cpfNormal = new RegExp(/\D/g);
var txt = cpf.replace(cpfNormal,'');
if(txt.length == 11) {
alert("CPF: " + txt);
} else {
alert("CPF inválido!");
}
}
And the manifest.json is:
{
"name": "PJe - CPF - CNPJ - N. Processo",
"version": "1.0",
"description": "Extensao do PJe",
}
I'm getting the error msg: "Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution."
I really don't get it.
=(
How are you calling the function
ajustaCpf()
?If you are calling it
inline
frompopup.html
, then it's not allowed in a chrome plugin.You would need to move the handler to your
magica.js
file.Issue I am referring to: stackoverflow.com/questions/363243...
If that doesn't help try and post your code on github so I can take another look.
Thanks a lot!!
Yes, I was doing it inline:
I'll try what you referred. Sooner or later we'll talk again.
;)
It worked!
Thanks a lot for your help!!
Keep the good work!
;)