我正在尝试创建我的第一个 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 并显示警告框。