我正在尝试创建我的第一个chrome扩展,这是我的manifest.json
{
"name": "share2twitter",
"version": "0.1",
"manifest_version": 2,
"browser_action":{
"default_icon": "icon.png",
"default_popup": "index.html"
},
"background": {"page": "index.html"},
"permissions": [
"https://www.googleapis.com/*",
"tabs"
],
"content_scripts": [{
"matches": [ "http://*/*", "https://*/*" ],
"js": [ "jquery.min.js","index.js" ]
}],
"content_security_policy": "script-src https://www.googleapis.com/urlshortener/ 'self'; object-src 'self'; connect-src https://www.googleapis.com/"
}https://github.com/kracekumar/share2twitter/blob/master/manifest.json,在调试模式下,我得到以下错误。
Refused to load script from 'https://www.googleapis.com/urlshortener/v1/url?callback=jQuery17108621194534935057_1344774835421&{%22longUrl%22:%22https://groups.google.com/a/chromium.org/forum/?fromgroups' because of Content-Security-Policy.我查看了mappy,stackoverflow.com和谷歌官方文档的参考资料,都没有结果。所以我在这里请求帮助。
预期行为:当我单击扩展时,它会尝试连接到goo.gl url shortner,并显示警告框。
发布于 2012-08-13 13:09:04
内容安全策略值中不允许源URL中的路径。您需要在您的清单中使用以下内容:
"content_security_policy": "script-src https://www.googleapis.com 'self'; object-src 'self'; connect-src https://www.googleapis.com"
A Chromium bug已经被归档(并且正在进行一些工作),以便在这种情况下更好地发出警告。
https://stackoverflow.com/questions/11922642
复制相似问题