javascript - jQuery not working in background.js of chrome extension -
i making chrome extension. here manifest:
{ "manifest_version": 2, "name": "roblox-r", "version": "1", "description": "an extension 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 not load use background.js. know because if go background page of script while it's running, says, "uncaught referenceerror: $ not defined". how fix this? thanks.
the content_scripts property intended link scripts , stylesheets injected in context of webpage extension active. if want use jquery in background page, should add jquery.min.js scripts property of background:
"background": { "scripts": ["jquery.min.js", "background.js"] } hope helps.
Comments
Post a Comment