I want a javascript instruction that will allow me to open a new default (empty) browser tab,
So far I've tried this window.open('chrome://newtab', '_blank');
But the browser returns the following error, Not allowed to load local resource: chrome://newtab/
, even when serving the code with a local server
Asked
Active
Viewed 111 times
0

Am ine
- 25
- 5
-
https://stackoverflow.com/questions/39007243/cannot-open-local-file-chrome-not-allowed-to-load-local-resource – j08691 Dec 15 '21 at 17:07
-
I pointed out that I have served the code using a local server, still get the same error though, so that didn't solve it – Am ine Dec 15 '21 at 17:11
2 Answers
2
The thing is you cannot load local resources.
This is also true for chrome://settings/
since Chrome doesn't want to let websites trick inexperienced users into changing the settings.
I'm sure you have already tried this but the closest alternative is loading an about:blank
tab with window.open("");
Or, since most of the users have a search engine in their new tab, you can just load window.open("https://www.google.com/");
.
The bottom line is You can't load anything that starts with chrome://

raven
- 43
- 1
- 7
-
thing is, I am only interested in opening the browser native new tab, but guess it ain't possible after all – Am ine Dec 15 '21 at 18:00
1
You aren't allowed to open a chrome://
tab because that is a security risk, so the browser restricts it. It is also not the best solution since it only works on Chrome. Instead, you should open about:blank
.
window.open('about:blank', '_blank');

fin444
- 725
- 2
- 14
- 27
-
1I'm currently only targeting chrome, I'm well aware of the code snippet you've suggested, Only that doesn't actually open a default new tab. Is there any way I can bypass this security restriction ? – Am ine Dec 15 '21 at 17:33
-
@DamilaWhiShadow If you are only targeting Chrome, does that mean that you are writing an extension? – fin444 Dec 15 '21 at 17:34
-
You could say that, but for now I'm only trying to accomplish the action in question – Am ine Dec 15 '21 at 17:39