Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Chrome扩展名:Manifest.json在选项中包含JS_Javascript_Json_Google Chrome - Fatal编程技术网

Javascript Chrome扩展名:Manifest.json在选项中包含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" },

基本问题,在manifest.json中我的“选项页面”中包含javascript的最佳方式是什么?我很确定我有两个错误,如何包含js&如何包含页面的命名/参数

任何帮助都将是惊人的

下面是我得到错误的地方:

 {
    "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>