简体   繁体   English

window.open在Google Chrome中打开标签页和窗口

[英]window.open opening tabs and windows in Google Chrome

I have this JS function who activates when a button is clicked: 我有这个JS函数,当点击一个按钮时激活它:

function redirect() {
        win = window.open(\"$ref\", target=\"_blank\");
        win2 = window.open(\"$ref\", target=\"_blank\");
        win3 = window.open(\"$ref\", target=\"_self\");
}

First call to window.open opens a new tab in Chrome, second window.open opens a new window and the third window.open successfully "redirects" the original window to $ref. 首先调用window.open在Chrome中打开一个新选项卡,第二个window.open打开一个新窗口,第三个window.open成功地将原始窗口“重定向”到$ ref。

My question is: why the first and the second window.open open both a tab and a window? 我的问题是:为什么第一个和第二个window.open打开一个标签和一个窗口? Is there any way to open only tabs? 有没有办法只打开标签?

A have solved this problem and create a gist . A已经解决了这个问题并创造了一个要点 It open 3 links in tabs. 它在标签中打开3个链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM