Reputation: 27265
I'm developing a Chrome extension that ships jQuery and jquery is referenced from the manifest.json and works as expected when I reference to it from other JS files in my extension package.
However from Chrome console, even though I know my extension is loaded jQuery is not accessible
I tried accessing it like this:
$('div').append();
etc. or
jQuery
and neither of them works.
Not having console with jQuery support hinders the development process a lot.
Upvotes: 1
Views: 382
Reputation: 193261
I would define your additional content script which would embed jQuery into every page.
manifest.json
{
"name": "Content script",
"version": "0.1",
"content_scripts": [{
"matches": ["http://*/*"],
"js": ["jquery-loader.js"]
}]
}
And inside jquery-loader.js
:
var script = document.createElement('script');
script.src = 'jquery.min.js';
(document.body || document.head).appendChild(script);
This way you would have jQuery on any page.
Upvotes: 3