用javascript打开一个新选项卡,但使用javascript保持当前选项卡 [英] Open a new tab with javascript but stay on current tab using javascript

查看:83
本文介绍了用javascript打开一个新选项卡,但使用javascript保持当前选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 window.open(http://www.google.com); 函数在浏览器中打开新选项卡,但可以打开它在后台并保持在当前页面上?
当我点击超链接时,页面将会保持不变,但链接将在新标签页中打开...

Is it possible to open a new tab in browser using the window.open("http://www.google.com"); function, but open it in the background and remain on the current page? When i Click in hyperlink the page will same but link will open in new tab...

我尝试这个解决方案,但它只能在Firefox 链接
但我想要在所有浏览器中都可以做到。

I try this solution but it work only in Firefox link but I want to do in all browsers.

推荐答案

正如在两者中所证实的那样: source1
source2

As confirmed in both: source1 source2

没有一个适用于所有浏览器的函数。有弹出窗口的选项,但这不是一个好主意,因为许多人使用弹出窗口拦截器。

there isn't a function that works throughout all browsers. There are options for popups, but this isn't a good idea as many use popup blockers.

重申第一个来源,它是每个用户决定的浏览器设置在后台打开一个新标签,或不。而且,由于用户在浏览器设置中决定了这一点,您将获得不一致的体验。

To reiterate the first source, it's a browser setting for each user to decide to open a new tab in the background, or not. And because users decide this in their browser settings you will get inconsistent experiences.

这篇关于用javascript打开一个新选项卡,但使用javascript保持当前选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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