Reputation: 71
I am making a chrome extension. Here is my manifest:
{
"manifest_version": 2,
"name": "ROBLOX-R",
"version": "1",
"description": "An extension to automatically trade currencies.",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
"<all_urls>"
],
"content_scripts": [{
"matches": ["<all_urls>"],
"js": [ "jquery.min.js" ]
}],
"background": { "scripts": ["background.js"] }
}
Jquery.min.js does not load for use into background.js. I know this because if I go to the background page of my script while it's running, it says, "Uncaught ReferenceError: $ is not defined". How do I fix this? Thanks.
Upvotes: 2
Views: 1563
Reputation: 1032
The content_scripts
property is intended to link scripts and stylesheets that will be injected in the context of webpage where your extension will be active. if you want to use the jQuery in the background page, you should add the jquery.min.js
to the scripts
property of the background
:
"background": {
"scripts": ["jquery.min.js", "background.js"]
}
Hope it helps.
Upvotes: 2