2017-07-15 10 views
0

基本的な質問は、manifest.json内の「options_page」にjavascriptを含める最もよい方法は何ですか?かなり2つのエラーがあります。どのように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ページを宣言して、スクリプトをhtmlに<script>として追加してください。あなたのオプションページはdomを他のウェブサイトと共有しないので、そのような広範なセキュリティ制限はありません。

<script src="options.js"></script> 
関連する問題