複数のドメインから外部スクリプトが読み込まれるChromeプラグインを開発しています。これらのドメインを許可する方法についてのドキュメントといくつかのチュートリアルを確認しました。
私がチェックしたドキュメント:
- 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'"
}
このChromeは、次のように応答します。
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
もちろん、私はいくつかの組み合わせを試しましたが、すべて失敗しました。1つのドメインのみを使用する場合にのみ機能します。どうすればさらに追加できますか?