Chrome扩展清单返回错误

时间:2014-02-10 17:20:12

标签: google-chrome google-chrome-extension manifest

无论我做什么,清单都会返回以下错误:

 Could not load extension from 
 '/Applications/XAMPP/xamppfiles/htdocs/lab/chrome/test'. Manifest is not valid JSON.
 Line: 28, column: 2, Trailing comma not allowed.

但是我已经从chrome托管的开发站点引用并复制了它。我陷入了第一步。以下是我的清单

{

  "manifest_version": 2,
  "name": "Same Extention",
  "version": "1",

  "default_locale": "en",
  "description": "A description",



 "content_scripts": [
    {
      "matches": ["http://www.google.com/*"],
      "css": ["mystyles.css"],
      "js": ["jquery.js", "myscript.js"]
    }
  ],

}

我提到的Chrome文档:Here& Here

2 个答案:

答案 0 :(得分:3)

删除content_scripts数组末尾的逗号。

而不是:

"content_scripts": [
    {
      "matches": ["http://www.google.com/*"],
      "css": ["mystyles.css"],
      "js": ["jquery.js", "myscript.js"]
    }
  ],

尝试:

"content_scripts": [
    {
      "matches": ["http://www.google.com/*"],
      "css": ["mystyles.css"],
      "js": ["jquery.js", "myscript.js"]
    }
  ]

答案 1 :(得分:0)

"page_action": {
  "default_popup": "popup.html"
},

你添加这样的东西,应该在popup.html之后删除“,” 然后整个代码如下:

"page_action": {
  "default_popup": "popup.html"
},
相关问题