Load JQuery into a Chrome extension?

后端 未结 5 563
鱼传尺愫
鱼传尺愫 2020-11-29 06:39

I\'m attempting to load JQuery into my Chrome extension and make it equal to an object but I\'m wondering how would I go about this? basically I\'d like something like...

5条回答
  •  醉话见心
    2020-11-29 07:04

    You can just put jquery.js into extension folder and include it in the manifest:

    {
      "name": "My extension",
      ...
      "content_scripts": [
        {
          "matches": ["http://www.google.com/*"],
          "css": ["mystyles.css"],
          "js": ["jquery.js", "myscript.js"]
        }
      ],
      ...
    }
    

    You don't need to worry about conflicts with jQuery on a parent page as content scripts are sandboxed.

提交回复
热议问题