使用JavaScript在新选项卡(而不是新窗口)中打开URL [英] Open a URL in a new tab (and not a new window) using JavaScript

查看:124
本文介绍了使用JavaScript在新选项卡(而不是新窗口)中打开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.

CSS3提议 target-new ,但规范被放弃了

反向不是真的;通过在 window.open 的第三个参数中指定窗口的尺寸,可以在首选项用于标签时触发新窗口。

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

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

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