Search code examples
javascriptjqueryjquery-uigoogle-chrome-extensionmanifest.json

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.


Solution

  • 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 through the use of content functions, 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"
        }
      ],