jQuery in Google Chrome Content Script?

Google Chrome-Extension

Google Chrome-Extension Problem Overview


How would I go about including the jQuery library in my Google Chrome Content Script? I have tried, fruitlessly, of course. Should I use <script src="..." /></script>, or is there a different/better way to go about it? Thanks in advance!

Google Chrome-Extension Solutions


Solution 1 - Google Chrome-Extension

Putting it into your background html doesn't do what you want. You need to mention it in your manifest.json, like this:

{
  "name": "MyExtension",
  "version": "0.1",
  "description": "blah blah",
  "background_page": "background.html",
  "content_scripts": [
    {
      "matches": ["http://*/*","https://*/*"],
      "css": ["extension.css"],
      "js": ["jquery-1.4.2.js", "extension.js"]
    }
  ]
}

Solution 2 - Google Chrome-Extension

The above answer works. An alternate answer which uses injection (which is what I was really looking for when I found this page first) is here:

https://stackoverflow.com/questions/4698118/google-chrome-extensions-how-to-include-jquery-in-programatically-injected-cont

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionesqewView Question on Stackoverflow
Solution 1 - Google Chrome-ExtensionGrantView Answer on Stackoverflow
Solution 2 - Google Chrome-ExtensionjayView Answer on Stackoverflow