Javascript Chrome扩展名:Manifest.json在选项中包含JS
基本问题,在manifest.json中我的“选项页面”中包含javascript的最佳方式是什么?我很确定我有两个错误,如何包含js&如何包含页面的命名/参数 任何帮助都将是惊人的 下面是我得到错误的地方:Javascript Chrome扩展名:Manifest.json在选项中包含JS,javascript,json,google-chrome,Javascript,Json,Google Chrome,基本问题,在manifest.json中我的“选项页面”中包含javascript的最佳方式是什么?我很确定我有两个错误,如何包含js&如何包含页面的命名/参数 任何帮助都将是惊人的 下面是我得到错误的地方: { "name": " name of app", "version": "0.1", "description": "app stuff", "background": { "page": "background.html" },
{
"name": " name of app",
"version": "0.1",
"description": "app stuff",
"background": {
"page": "background.html"
},
"manifest_version": 2,
"browser_action": {
"name": "Manipulate DOM",
"icons": ["icon.png"],
"default_icon": "icon.png"
},
"options_ui": {
// Required.
"page": "options.html",
"js": "options.js", // the file i'm trying to add (for fun)
"chrome_style": true,
}, //where chrome keeps flagging the error.
"content_scripts": [{
"js": ["jquery-2.0.2.min.js", "background.js"],
"css": ["customStyles.css"],
"matches": ["http://*/*", "https://*/*"]
}]
}
您需要从“chrome样式”中删除逗号:true,您不需要在清单中包含选项脚本。只需声明html页面并将脚本添加为html中的
。您的选项页面不与其他网站共享dom,因此它没有如此广泛的安全限制
<script src="options.js"></script>