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.

user2950593
  • 9,233
  • 15
  • 67
  • 131
  • That you fixed one error and got another doesn't mean that fixing the first error caused the second one to suddenly appear, it just means that the second error wasn't visible for some reason until you fixed the first. In this case, invalid JSON prevented it from knowing what the JSON value was, so it couldn't tell you about incorrect values until after you made the JSON valid. – Nic Mar 27 '17 at 05:23
  • I found this question helpful. – Altimus Prime Jul 13 '19 at 21:19

1 Answers1

1

You need to remove that comma for sure.

As the error states, you have given an invalid value for matches property.

This value should be as per the syntax given in docs.

If you want to match all URLs (I presume this from the use of *), use following value in your manifest.

"matches": [ "<all_urls>" ],
Yogesh
  • 699
  • 1
  • 6
  • 21