我的 Google Chrome 扩展程序的 manifest.json 存在问题。我想在后台加载脚本。当我想加载扩展程序时,出现语法错误,这是由第 10 行中的冒号引起的。我查看了 Google Chrome 开发人员文档,但没有找到任何有用的信息。你能帮我吗:D
{
"name": "Test",
"version": "1.0",
"manifest_version": 2,
"description": "Test",
"browser_action": {
},
"permissions": [["webRequest","webRequestBlocking",
"*://*.Test.com/*/*" ],
**"background": {**
"scripts": ["background.js"]
},
]
}
最佳答案
您的 JSON 无效,并且确实存在语法错误。看起来您试图将背景作为权限数组的一部分,但它应该是这样的。
{
"name": "Test",
"version": "1.0",
"manifest_version": 2,
"description": "Test",
"permissions": [
"webRequest",
"webRequestBlocking",
"*://*.Test.com/*/*"
],
"background": {
"scripts": ["background.js"]
}
}
保持 JSON 格式良好通常有助于防止此类错误。祝您的扩展顺利。
关于google-chrome-extension - 背景后的冒号(用于加载background.js),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12443268/