0

I migrate my extension to manifest v3. I need to redirect to page from web_accessible_resources.

I get page:

const EXT_PAGE = chrome.runtime.getURL('/test.html');

And adding a rule with an action:

action: {
    "type": "redirect",
        "redirect": {
        "regexSubstitution": EXT_PAGE + ";\\0"
    }
}

String EXT_PAGE = "chrome-extension://.../test.html..." but after redirect chrome open https://www.chrome-extension//.../test.html... . It is wrong url. How I can redirect to exact chrome-extension://.../test.html...?

  • It might mean you need to fix your `regexFilter` to not include the result of regexSubstitution. Another problem is that there's no such page: try replacing `;` with `#`. – wOxxOm Oct 06 '22 at 15:41
  • I change my rule: `"regexSubstitution": EXT_PAGE}` I see variable EXT_PAGE in devtools it is equals `chrome-extension://.../test.html`. And if i open url it will work correct. After redirect by my rule I see `https://www.chrome-extension//.../test.html` in url. Added `https://www.` and delete `:` before `//`. why has url changed? – Nikolai Lokhno Oct 06 '22 at 16:02
  • When I use `"extensionPath": "/test.html"` everything works okay. But I need to use regexSubstitution because I need to get original url ( '\0' ) – Nikolai Lokhno Oct 06 '22 at 16:19

0 Answers0