2017-07-15 40 views
0

基本问题,在manifest.json中我的“options_page”中包含javascript的最佳方式是什么?很确定我有两个错误,我如何包含我包含该页面的命名/参数的js &。Chrome扩展程序:Manifest.json包含选项中的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://*/*"] 
    }] 
} 

回答

0

你需要从"chrome_style": true,

0

删除逗号你并不需要包括在清单中选择脚本。只需声明html页面并将脚本作为<script>添加到您的html中。您的选项页面不会与其他网站共享,所以它没有如此广泛的安全限制。

<script src="options.js"></script> 
相关问题