Skip to content Skip to sidebar Skip to footer

How Do I Open The "new Tab" Page Explicitly In Chrome From A Web Page?

On typing chrome://newtab or about:newtab in Google Chrome's Address Bar, we can explicitly open a new tab. How can we do the same from a Web Page ? I tried it on a hyper-link, lik

Solution 1:

The best you can do to open a new tab, is open a blank page.

Colon's are required to open urls like chrome:newtab:

var win = window.open('http://chrome:newtab', '_blank');

but they are not allowed in any url:

A colon is reserved and may not be used unencoded except for its special purpose (which depends on the scheme). Section 2.2:

Many URL schemes reserve certain characters for a special meaning: their appearance in the scheme-specific part of the URL has a designated semantics. If the character corresponding to an octet is reserved in a scheme, the octet must be encoded. The characters ";", "/", "?", ":", "@", "=" and "&" are the characters which may be reserved for special meaning within a scheme. No other characters may be reserved within a scheme.

Even if you try to encode it:

var win = window.open('http://chrome%3Anewtab', '_blank');

Chrome will not allow you to do that. You most likely already saw:

Unable to open a window with invalid URL 'http://chrome:newtab/'.

Chrome will allow you to use colons, but only as parameters. Look at the example below, and note the question mark in the second url.

rejected

var win = window.open('http://something.com%3Apro', '_blank');

permitted

var win = window.open('http://something.com?%3Apro', '_blank');

Solution 2:

In hyperlink, you need to put target="_blank" in the a balise.

Post a Comment for "How Do I Open The "new Tab" Page Explicitly In Chrome From A Web Page?"