I have a Chrome Extension that when I click on a button on the Popup page, it sends a msg to a Background script. This Background script then creates a Tab and the URL is just the index.html file that goes along in the extension installation. (it's in the root of the extension's folder)
chrome.tabs.create({ url: "index.html" }, (tab) => { });
Well, it does create the tab with the correct index.html, but the url in the address bar / omnibox is:
chrome-extension://pdkkaldkelomkfiohdhcklphjclggmoh/index.html
And the problem is that I need to attach a Content Script for this index.html and in the Official Chrome Docs at https://developer.chrome.com/docs/extensions/mv3/match_patterns/
there's no matches for something like: chrome-extension://
I tried using: and file:///* , no error msgs, but when I'm at the index.html page, in the Dev Tools I check for the Content Scripts tab, but the content.js was not loaded.
Also tested with:
"content_scripts": [
{
"matches": [
"*://pdkkaldkelomkfiohdhcklphjclggmoh/index.html"
],
"js": [
"content.js"
]
}
]
no error msgs, and with the full path: "chrome-extension://pdkkaldkelomkfiohdhcklphjclggmoh/index.html" I get an error when refreshing the extension:
Invalid value for 'content_scripts[0].matches[0]': Invalid scheme.
Could not load manifest.
It doesn't accept the "chrome-extension://" part of the match string.
I'm probably doing something wrong because I'm sure I can work with a local file that will be installed as part of the extension's set of files.
Any ideas please let me know and thanks in advance!