开发者问题收集

Chrome 扩展程序清单返回错误

2014-02-10
3520

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

 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 文档: 这里 & 这里

1个回答

删除 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"]
    }
  ]
CD..
2014-02-10