I'm learning about Chrome extensions and making some hello world apps. I'm working on Content scripts here.
Firstly, my app is very simple, it is just a manifest that loads a content script.
This is the manifest
{
"name": "turn all th into TH",
"version": "1.0",
"permissions": [
"http://*/*"
],
"manifest_version": 2,
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["contentScriptFirstApp.js"]
}
]
}
and the contentscript is just one line
alert('hello');
Now i run this, the alert box shows up every time a page is loaded.
However, the strange thing is, although the code is running, i cannot find the ContentScript in the Developer tools.
It's only when I make a slight adjustment to my manifest, changing the matches parameter so that instead of allowing , it only matches with http files as below that I can see the content script in the developer tools.
{
"name": "turn all th into TH",
"version": "1.0",
"permissions": [
"http://*/*"
],
"manifest_version": 2,
"content_scripts": [
{
"matches": ["http://*/*"],
"js": ["contentScriptFirstApp.js"]
}
]
}
Just curious why this is. In both cases, the code is running and showing the alert box, but why is it only when the content script pages has the "matches" parameter set as http pages only that it starts to show up in the developer tools?