Using jQuery in your content_script
Using jQuery in your Chrome extension as a content_script inorder to inject it into a webpage might be something you’re scratching your head over especially if you’re new to Chrome extension development (which at the time of writing pretty much everyone is).
So how do you setup your Chrome extension to enable the use of jQuery in you content_script. Basically all you have to do is add it to the content_scripts section in your manifest.json as illustrated bellow.
1
2
3
4
"content_scripts": [{
"matches": ["http://somesites.com/"],
"js": ["jquery-1.4.min.js","your_content_script.js"]
}]
That’s it! You can test it by placing an alert($) in you content_script.js file.
Suggestions, tips or flames? Please leave a comment. ♯Chrome ♯howto ♯content_scripts ♯extension ♯development ♯coding
google+ — facebook — twitter — stack overflow