【发布时间】:2016-06-07 02:27:39
【问题描述】:
我在我的 chrome 扩展程序中加载外部 js 文件时遇到问题。这是我的清单中的 csp 条目:
"content_security_policy": "script-src 'self' 'unsafe-eval' 'unsafe-inline' http://proto.office.atlassian.com; object-src 'self'"
这是我在 popup.html 中调用脚本的方式:
<script src="http://proto.office.atlassian.com/prototypes.js"></script>
这是我得到的错误:
Refused to load the script 'http://proto.office.atlassian.com/prototypes.js' because it violates the following Content Security Policy directive: "script-src 'self'"
我已确认我的 CORS 已在服务器上正确设置,我可以通过 XMLHttpRequest 拉出脚本就好了,但我似乎无法通过脚本标签加载一个或一旦我抓住它就对其进行评估.任何帮助将不胜感激:)
【问题讨论】:
标签: javascript google-chrome google-chrome-extension chromium