1

I'm working on an extension which opens up a file.html from the Browser Action's popup. file.html is located in the extension's folder.

Let's say my contentscript.js is simply

alert("Hello");

And my manifest.json contains (among other things)

"content_scripts": 
    [
        {
        "matches" : [ "<all_urls>" ],
        "js" : [ "contentscript.js" ],
        }
    ], 

Now, the alert shows up on every page I'm visiting, even file.html when opened normally. But the alert (or anything from the contentscript) doesn't show up when opened from this URL :

chrome-extension://cfhlgeljdipnicgineoheoihdofhnlef/page.html

I'm not sure how to make it accept the contentscript, any help will be appreciated.

EDIT : topic already discussed here : Does content_scripts matches "chrome-extension://*/*" work?

Community
  • 1
  • 1

1 Answers1

2

From the API docs:

content script matching are based on a set of URLs defined by match patterns. A match pattern is essentially a URL that begins with a permitted scheme (http, https, file, or ftp, and that can contain '*' characters. The special pattern <all_urls> matches any URL that starts with a permitted scheme.

chrome-extension is not a supported scheme, and therefore will not work.

levi
  • 23,693
  • 18
  • 59
  • 73