0

I have an MV3 extension where I have a file which I want to access via content script. I am unable to do that when I specify "extension_ids": ["myextId"] in manifest.json. However when I use "matches": ["<all_urls>"], I am able to access it. According to chrome docs

Each element must include a "resources" element and either a "matches" or "extension_ids" element.

I am getting the extension ID from extensions management page

enter image description here

Am i getting ID from the wrong place ?

Manifest.json

"web_accessible_resources": [
   {
        "resources": [
            "/sample.html",
        ],
        "extension_ids": ["liecbddmkiiihnedobmlmillhodjkdmb"]
    }
]

Error

Denying load of <URL>. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.
my.com/:40 Denying load of chrome-extension://liecbddmkiiihnedobmlmillhodjkdmb/sample.html. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.

Isnt the extension_Ids array supposed to contain the ids of all extensions that should be able to access it or am i understanding it wrong?

  • 1
    "Extension" in extension_ids means a context with a `chrome-extension://id/` URL and it's used to allow other extensions to access your resources, whereas content scripts run in the context of a web page which is `https://example.com/`. Hence you need to expose the resources everywhere your content scripts need them. – wOxxOm Jul 12 '23 at 19:15

0 Answers0