问题
Inside chrome-extension://<EXTENSION_ID>/hello.html
, the following code:
<script> alert("hi"); </script>
JS does not work? How to make it work?
回答1:
You cannot use inline JavaScript in a Chrome extension as per enforced Content Security Policy.
You will need to get rid of it, by placing it in an external JS file.
来源:https://stackoverflow.com/questions/23185406/javascript-does-not-work-in-chrome-extensions