Search code examples
javascriptgoogle-chrome-extensionchrome-extension-manifest-v3

page blocked by chrome


I am trying to create a chrome extension, that will redirect to custom html file. the page is blocked by the browser

manifest.json

{
    "manifest_version": 3,
    "name": "Hello World!",
    "version": "0.1.0",
    "content_scripts": [
        {
            "matches": ["<all_urls>"],
            "js": ["src/blocker.js"]
        }
    ],
    "permissions": ["storage", "activeTab", "tabs"],
    "action": {
        "default_popup": "src/html/popup.html"
    }
}

blocker.js

window.location.href = chrome.runtime.getURL("html/popup.html");

Page blocked Image


Solution

  • Either add blocked.html to web_accessible_resources in manifest.json or switch to using declarativeRequest API