8
我正在开发一个Chrome插件,其中从几个域加载外部脚本。我已经查阅了关于如何允许这些域的文档和一些教程。如何在Chrome插件中将多个域添加到content_security_policy?
的文档我检查:
- http://developer.chrome.com/extensions/contentSecurityPolicy.html
- http://www.html5rocks.com/en/tutorials/security/content-security-policy/
- http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#syntax
这一切说了同样的,从中我创造了manifest.json的规则:
{
// .. general settings
"content_security_policy": "script-src 'self' https://ajax.googleapis.com http://mysite.com; object-src 'self'"
}
对此回应铬如下:
Could not load extension from '/Users/itarato/Desktop/DRC Tutorial Client'.
Invalid value for 'content_security_policy': Both 'script-src' and 'object-src' directives must be specified (either explicitly, or implicitly via 'default-src'), and both must whitelist only secure resources.
You may include any of the following sources: "'self'", "'unsafe-eval'", "http://127.0.0.1", "http://localhost", or any "https://" or "chrome-extension://" origin.
For more information, see http://developer.chrome.com/extensions/contentSecurityPolicy.html
当然,我已经试过几种组合,但所有失败了。它只适用于我只使用一个域。我如何添加更多?
非常感谢你:)完全错过了它是指https。 – itarato