自 Firefox 4 以来,这似乎是一个奇怪的功能变化。使用 window.open() 打开窗口后,使用鼠标中键单击打开的窗口中的链接(或右键单击并选择“在新选项卡中打开”)导致链接在旧窗口的新选项卡中打开。
在 Firefox 3 中,该选项卡将在新窗口中打开。
示例代码,index.html:
<html>
<head>
<script type="text/javascript">
function foo() {
var w = window.open('page2.html', 'foobar', 'target=_blank');
}
</script>
</head>
<body>
<a href="#" onclick="foo()">bar</a>
</body>
</html>
page2.html:
<html>
<head />
<body>
<a href="www.google.com">google</a>
</body>
</html>
从 index.html 打开 page2 并中键单击 google 链接后,包含 index.html 的窗口中会出现一个新选项卡。
有谁知道如何解决这一问题?
编辑:Chrome 做同样的事情。