简体   繁体   中英

How can I use JQuery in my Google Chrome extension with Manifest 3?

I am trying to figure out how I can use JQuery in my background.js for Google Chrome extension development for Manifest 3. All of the other answers I have found are for Manifest 2.

Thank you in advance for the help.

After some more research and time spent trying to figure out how to make this work I figured it out.

To add jquery to your background.js you need to add the following to your manifest.

  "content_scripts": [
    {
      "css":["/css/jquery/jquery-ui.min.css", "/css/jquery/jquery-ui.structure.min.css"],
      "js":["/js/jquery/jquery-3.6.0.min.js", "/js/jquery/jquery-ui.min.js"],
      "matches": ["*://*/*"],
      "run_at": "document_end"
    }
  ],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM