How to enable online javascript execution? (google extension)

0

Hello, I was putting together 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 it as an 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 for the help right away.

    
asked by anonymous 17.02.2018 / 21:38

1 answer

-2
21.02.2018 / 18:15