1

I am creating a chrome extension using manifest v3 where I's like it to open a new tab for the user but it is denying me permission to the new tab.

I've tried opening the new tab by doing

window.open("chrome://new-tab-page", "_blank")

and also I've tried changing the current tab to new tab by doing

window.location.href = "chrome://new-tab-page"

I've been doing these in the content scripts, should I try background scripts? Please help and thank you.

  • did you try `chrome.tabs.create`? – technophyle Jan 04 '23 at 17:04
  • You cannot use window.open or window.location.href to open a new tab to a chrome:// URL in a Chrome extension's content script. This is because Chrome extensions are not allowed to access the chrome:// scheme, as it could potentially allow extensions to access and modify internal Chrome pages and settings. One option you could try is using chrome.tabs.create to open a new tab to a URL that your extension is allowed to access. For example: `chrome.tabs.create({ url: "https://www.example.com" }); ` – 0xwaleed Jan 04 '23 at 17:07
  • Does this answer your question? [Link to chrome:// url from a webpage](https://stackoverflow.com/questions/40362775/link-to-chrome-url-from-a-webpage) – Christopher Jan 04 '23 at 17:08

1 Answers1

0

Try Disabling the Chrome Security Settings Since the error is caused due to the security feature of Chrome, the first thing you can do is disable the security settings. It is not recommended, but if it solves the issue, you can proceed with it.

Make sure the resource you are trying to load is not malicious. You should take care of it yourself. Else you will be vulnerable to attacks. Consider re-enabling the security after you are done loading the resources. Here’s how to do it:

Click the menu button (⋮) in the top right corner of the Chrome window. Select Settings from the list of options. Click Privacy and Security from the left pane of the Settings page. Select the Security menu in the right section. Under Safe Browsing, click No protection (not recommended).