Javascript does not work in Chrome extensions

守給你的承諾、 提交于 2020-01-06 14:16:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!