'Opening chrome extension programmatically with multiple entry points

I'm opening a chrome extension programmatically from the background script with the following code:

background.js

chrome.windows.getLastFocused().then((window) => {
    const width = 600 + 100;
    const height = 400 + 100;
    const left = window.width - width;
    chrome.windows.create({url: "./index.html", type: "popup", height: height, width: width, left: left, focused: true});
}); 

This works perfectly fine for ./index.html, but not for any other path like ./approvals.html although this page exists.

Navigating in the extension with a link from index.html to approvals.html works smooth, but directly opening the extension with this path results in ERR_FILE_NOT_FOUND.

I think it might be related to some missing permissions, following my manifest.json:

{
    "name": "Chrome React Extension",
    "description": "The power of React for building interactive Chrome extensions",
    "version": "1.0",
    "manifest_version": 3,
    "action": {
        "default_popup": "index.html",
        "default_title": "Open the popup"
    },
    "permissions": [
        "storage"
    ],
    "content_scripts": [
        {
        "matches": ["<all_urls>"],
        "js": ["content.js"]
        }
    ],
    "background": {
        "service_worker": "background.js"
    }
}

Any help is really appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source