0
Hello, I was mounting an extension that received urls in a form and added new fields when a button was pressed. Running as normal html the code works, but when I run as extension it returns this error:
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.
HTML used:
<form id="formulario">
<input type="url" class="campo" placeholder="endereço..." />
<div onclick="sis_interface.novocampo();" class="novocampo"></div>
</form>
JAVASCRIPT used:
var sis_interface = {
novocampo : function() {
document.getElementById("formulario").innerHTML += '<input type="url" class="campo" placeholder="endereço..." />';
}
}
Thanks in advance for the help.
Try looking at this topic: https://stackoverflow.com/questions/36622181/how-to-fix-chrome-extension-inline-javascript-invocation-error
– user81560
Scripts are in the same domain as the page?
– Sam