0

I am building browser extension This is manifest.json

{
  "name": "JS Code Injection",
  "version": "1.0",
  "manifest_version": 2,
   "web_accessible_resources": [
    "/injected.js"
  ],
  "content_scripts": [
    {
      "matches": [ "*" ],
      "js": [ "jquery.js", "background.js" ],
         "run_at": "document_end",
    }
  ]
}

Manifest is not valid JSON. Line: 13, column: 6, Trailing comma not allowed.

What's wrong with my manifest.json file here?

Also I tried to remove comma here

"run_at": "document_end",

And got this error:

Invalid value for 'content_scripts[0].matches[0]': Missing scheme separator.

4

1 回答 1

1

您肯定需要删除该逗号。

如错误所述,您为matches属性提供了无效值。

该值应符合docs中给出的语法。

如果您想匹配所有 URL(我假设这是使用 *),请在清单中使用以下值。

"matches": [ "<all_urls>" ],
于 2017-03-26T14:54:49.090 回答