开发者

How can I package JSON files with my chrome extension?

开发者 https://www.devze.com 2023-02-20 16:53 出处:网络
I have created an extension containing a pre-existing javascript file. This javascript file requires a json config file in the same directory, but putting that file in the same directory in the extens

I have created an extension containing a pre-existing javascript file. This javascript file requires a json config file in the same directory, but putting that file in the same directory in the extension folder didn't work. Is there some special way I have to do thi开发者_如何学Cs?

This problem also proved IMPOSSIBLE to Google since all extensions needs a json manifest file.


Try adding it in the content_scripts section of the manifest.json.

  "content_scripts": [
    {
      "matches": ["https://*/*", "http://*/*"],
      "js": ["extension.js", "config.json"],
      "run_at": "document_start",
      "all_frames": true
    }
  ],
0

精彩评论

暂无评论...
验证码 换一张
取 消