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