0

Chrome extension refused to execute inline script.

Based on past research, I have seen that you have to make a connection between the HTML and you javascript file, done that still not worked.

popup.html-

<html>
<body>
<button type="button" id="fill">Fill</button><br>
<script src="popup.js"></script>
<body>
</html>

popup.js-

document.getElementById("fill") = Fill;

function Fill(){
document.getElementById("first_name").value = "somefirstname";
}

Full error message- Refused to execute inline script 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-8AeKgC4PZyj0Lyp/7zt8lB898NYpYADMsfcJvqOwoDs='), or a nonce ('nonce-...') is required to enable inline execution.

AJ2796
  • 1
  • 2
  • Simply put the code into a separate js file, [more info](/a/25721457). – wOxxOm Aug 25 '19 at 05:18
  • Possible duplicate of [onClick within Chrome Extension not working](https://stackoverflow.com/questions/13591983/onclick-within-chrome-extension-not-working) – wOxxOm Aug 25 '19 at 05:18
  • I have it in a javaascript file, but I am still getting this error. – AJ2796 Aug 25 '19 at 23:03
  • This means that I am trying to make a change on the website right? Because this is what I want? – AJ2796 Aug 25 '19 at 23:04
  • No, the error message clearly states you have an inline script, not a separate script. Also, to change the web page you need a content script, not a popup script. – wOxxOm Aug 26 '19 at 04:54

0 Answers0