【发布时间】:2013-05-09 03:03:12
【问题描述】:
我的第一个 GC 扩展的脚本在加载为 .crx 时不起作用。我检查了调试部分,这是我的错误:
拒绝执行内联事件处理程序,因为它违反了以下内容安全策略指令:“script-src 'self' https://www.lolking.net/”。 popup.html:8
拒绝执行内联事件处理程序,因为它违反了以下内容安全策略指令:“script-src 'self' https://www.lolking.net/”。 popup.html:9
所以我猜这个错误来自 manifest.json 文件:
{
"name": "LolKing Searcher",
"version": "1.1",
"manifest_version": 2,
"description": "Search your LoL profile",
"content_security_policy": "script-src 'self' https://www.lolking.net/; object-src 'self'",
"permissions": [
"tabs",
"http://*/*/"
],
"content_scripts": [
{
"matches": ["http://*/*/","https://*/*/"],
"js": ["popup.js"]
}
],
"browser_action": {
"default_title": "LolKing Searcher",
"default_icon": "icon.png",
"default_popup": "popup.html"
}
}
每个建议都被很好地接受了!
【问题讨论】:
标签: google-chrome-extension manifest content-security-policy