如何打开“新建标签"从网页上在Chrome中显式显示页面? [英] How do I open the "New Tab" page explicitly in Chrome from a Web Page?

查看:70
本文介绍了如何打开“新建标签"从网页上在Chrome中显式显示页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google Chrome浏览器的地址栏中输入chrome://newtababout:newtab时,我们可以显式打开一个新标签页.

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 ?

我在超链接(例如<a href="chrome://newtab" target="_blank">Click to open the Chrome's 'New Tab' page</a>)上尝试过,但是它不起作用.

I tried it on a hyper-link, like <a href="chrome://newtab" target="_blank">Click to open the Chrome's 'New Tab' page</a>, but it doesn't work..

我什至尝试使用window.open('chrome://newtab','_newtab')使用JavaScript并使用window.location = chrome://newtab重定向,但都没有效果.

I even tried using JavaScript using window.open('chrome://newtab','_newtab') and redirection using window.location = chrome://newtab, neither worked..

是否有任何方法可以从网页上实现此目标,例如单击或重定向到newtab?

Is there any way to achieve this from a Web page, like by clicking or redirecting to the newtab ?

希望我的问题现在已经清楚了.

Hope my question is clear now.

推荐答案

打开一个新标签页所能做的最好的事情就是打开一个空白页.

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

冒号需要打开像chrome:newtab这样的网址:

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:

冒号是保留的,除其冒号外不得使用 特殊目的(取决于方案).第2.2节:

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

许多URL方案保留某些具有特殊含义的字符: 它们在网址中特定于方案的部分中的外观 指定的语义.如果一个八位位组对应的字符是 如果保留在方案中,则必须对八位字节进行编码.那些角色 ";", "/",?",:","@","="和&"是可能是 为方案中的特殊含义保留.不得有其他字符 保留在方案中.

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不允许您这样做.您最有可能已经看到:

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

无法打开带有无效URL' http://chrome:newtab/'的窗口.

Chrome允许您使用冒号,但只能用作参数.查看下面的示例,并注意第二个URL中的问号.

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.

被拒绝

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

允许

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

这篇关于如何打开“新建标签"从网页上在Chrome中显式显示页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆