javascript - 在浏览器窗口中打开新选项卡(使用 window.open 打开)

标签 javascript tabs window window.open

我通过 window.open 方法打开了一个新窗口,在该窗口的内容中我有一个带有“target=_blank”的链接。

当单击该链接时,该链接会在父窗口中打开新选项卡,而不是内容所在的选项卡。我还注意到,对于该窗口(使用 window.open 创建),Ctrl+T 快捷键(用于打开空白选项卡,Firefox)确实如此不行。

我检查了 window.open 规范,但没有找到任何允许此行为的选项。

var a = window.open("http://www.google.pl", 
"Test",
"width=640,height=480,scrollbars=yes,toolbar=yes,menubar=no,location=no,resizable=yes"); 
a.focus();

设置toolbar=yes 使其在Firefox 中工作。知道如何让它在 Chrome 中工作吗?

最佳答案

你能展示一些代码吗?

其他;尝试使用 JavaScript:

函数 OpenNew(){ window.open("http://www.google.se", "_blank"); }

Rgd

关于javascript - 在浏览器窗口中打开新选项卡(使用 window.open 打开),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31117525/

相关文章:

jQuery在一定窗口宽度以上触发函数

python - pywinauto:占用多个应用程序窗口

javascript - 如何从 Hub 中删除用户?

javascript - Angular Controller 不止一次触发。只有某些

javascript - 如何在选项卡更改时显示不同的 JointJS block

Android 爱彼迎之类的 Tabs

c# - WPF 中的 Aero 窗口 (C#)

javascript - Angular js 将本地数组与全局范围绑定(bind)

javascript - JS 有时会因计时器困惑而崩溃

javascript - 如何通过手机改善网站选项卡之间的交易