I met a strange problem which bothered me a lot.
To use the the content scripts, the manifest file is set as:
"content_scripts": [
{
"matches": [ ... ],
"js": [ "a.js", "b.js"]
}
]
a.js and b.js are put in the root directory of the project. It worked. To organize the project, I moved the two file into a folder, then modified manifest as:
"content_scripts": [
{
"matches": [ ... ],
"js": [ "lib/a.js", "lib/b.js"]
}
]
Then the extension cannot work and open the dev tool, the content scripts are all empty. If I revoke, then it works again. So what's wrong?
Thank you all!
The extension should work without problems if the scripts are in a folder.
You may do the following to solve this:
chrome://extensions/
and click the Reload
link near the extension; manifest.json
file, then you must manually reload the extension in chrome://extensions/
. Extensions Reloader does not reload changes from manifest.json
, but mostly the content script file changes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.