Chrome Extension Manifest 'Matches'

前端 未结 5 1965
甜味超标
甜味超标 2020-12-12 23:54

I\'m trying my hands at a simple Chrome Extension, but am running into a problem with providing a value for the matches array in my content_scripts

5条回答
  •  无人及你
    2020-12-13 00:12

    You need to surround the value of the content_scripts field in square brackets:

    "content_scripts": [ {
      "matches": ["http://*"],
      "js": ["scripts.js"]
    } ]
    

    (see the Chrome Docs for more info)

    Incidentally, using http://*/* would be a better match for all urls (see the docs), adding https://*/* if you also need to match those as well.

    Edit:

    Following your edit, the error you are getting is because of the match pattern being incorrect.

提交回复
热议问题