使用Javascript - 在新标签页中打开链接(同一窗口) [英] Javascript - Open Link in New Tab (SAME WINDOW)

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

问题描述

我知道有几个问题已经在所以对于这个话题,但他们都似乎很老....只是想获得一个向上的最新答案是:

I realize there are a couple questions already on SO for this topic, but they all seem to be quite old....just trying to get an up-to-date answer for this:

时打开一个新标签(在同一浏览器窗口中)的标准方式还是:

Is the standard way of opening a new tab (within the same browser window) still:

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

???

另外,我读过,它是依赖于浏览器的用户配置(新页面是否在新标签或一个新窗口打开,以及是否新标签/窗口获得焦点)... 。我想保持原来的选项卡上的焦点,但我更关心的是它在同一个浏览器窗口中打开一个标签(保持焦点仅仅是一个奖金)。

Also, I've read that it is dependent on the users config of their browser (whether the new page opens in a new tab or a new window, and also whether the new tab/window gets the focus)....I would like the focus to remain on the original tab, but I am more concerned with it opening a tab in the same browser window (keeping focus is just a bonus).

那么,有没有办法读/获取新的浏览器此设置? (铬,FF,即),并可能通知用户更改其设置,如果他们有它设置为在新窗口中打开?

So is there a way to read/get this setting in new browsers? (chrome, ff, ie) And possibly notify the user to change their settings if they have it set to open in a new window?

推荐答案

我已经取得了巨大的成功与

I have had great success with

<a target='_blank' > 

这篇关于使用Javascript - 在新标签页中打开链接(同一窗口)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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