Chrome应用内容安全政策

时间:2014-11-27 19:29:58

标签: google-chrome-app

错误:

拒绝加载脚本“https://ssl.google-analytics.com/ga.js”,因为它违反了以下内容安全策略指令:“default-src'self'chrome-extension-resource:”。请注意,'script-src'未明确设置,因此'default-src'用作后备。

background.html:9拒绝框架“https://www.youtube.com/embed/”,因为它违反了以下内容安全策略指令:“frame-src'self'data:chrome-extension-resource:”。

解决: 要解决此问题,我尝试添加

"content_security_policy": "script-src 'self' 'unsafe-eval'
https://www.youtube.com/ https://ssl.google-analytics.com/; object-src 'self'"

然后我收到警告:

'content_security_policy'仅适用于扩展程序和旧版打包应用,但这是打包的应用。

我该怎么办?

1 个答案:

答案 0 :(得分:2)

您无法直接从网络加载脚本。所有脚本都必须位于Chrome应用程序的文件夹中。这可能需要您下载脚本并将其放入Chrome App文件夹中的文件夹中。