Reputation: 2187
I'm developing Chrome Extension and I need to load a javascript file to content scripts, but that file is being served via webpack-dev-server. So it's approachable only on localhost.
I tried to change my manifest.json:
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*"
],
"js": [
"http://localhost:3000/scripts/content_bundle.js"
],
"run_at": "document_end",
"all_frames": false
}
But then I got an error in Chrome Extensions window:
Upvotes: 4
Views: 3727
Reputation: 73506
Only local files can be specified in "content_scripts"
section.
Solution:
"permissions": ["http://localhost:3000/scripts/*", "tabs"]
to manifest.json chrome.storage.local
or localStorage
(so you can load it on every extension start from the storage without redownloading) RequestContentScript
action (despite the warning on the doc page it should be actually supported in the Stable channel but of course do some tests first).Upvotes: 4