Problem description:
When the development of chrome expansion, when the page of the page needs JS, the JS directly writes the JS on the dynamic binding JS event. It will be prompted:
Refused to Execute Inline Script Because It Violates The Follow Content Security Policy Directive: "Script-SRC 'SELF' CHROME-EXTENSION-Resource:". Then, then
Solution:
In the popup.html, the external JS file dynamically binds the JS event, such as:
Copy code code as follows:
<script type = "text/javascript" charset = "utf-8" src = 'test.js'> </script>
Test.js:
Copy code code as follows:
var listbox = document.GetelementByid ("Showlist");
listbox.onClick = Function () {
document.GetelementByid ("player_sidebar"). STYLE.Width = 100;
}