在新标签页(而不是新窗口)中打开URL [英] Open a URL in a new tab (and not a new window)

查看:117
本文介绍了在新标签页(而不是新窗口)中打开URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在新标签页(而不是弹出窗口)中打开 URL 窗口.

I'm trying to open a URL in a new tab, as opposed to a popup window.

我看到了相关的问题,答案看起来像这样:

I've seen related questions where the responses would look something like:

window.open(url,'_blank');
window.open(url);

但是它们都不适合我,浏览器仍然尝试打开一个弹出窗口.

But none of them worked for me, the browser still tried to open a popup window.

推荐答案

作者无所不能,只能选择在新标签页中打开,而不是在新窗口中打开.这是用户首选项. (请注意,大多数浏览器中的默认用户首选项是针对新标签页的,因此在未更改首选项的浏览器中进行的琐碎测试不会证明这一点.)

Nothing an author can do can choose to open in a new tab instead of a new window; it is a user preference. (Note that the default user preference in most browsers is for new tabs, so a trivial test on a browser where that preference hasn't been changed will not demonstrate this.)

CSS3建议目标-新 ,但该规范已被放弃.

CSS3 proposed target-new, but the specification was abandoned.

反向不正确;通过在window.open()的第三个参数中为窗口指定某些窗口功能,可以在选项卡的首选项时触发新窗口.

The reverse is not true; by specifying certain window features for the window in the third argument of window.open(), you can trigger a new window when the preference is for tabs.

这篇关于在新标签页(而不是新窗口)中打开URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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