gpt4 book ai didi

javascript - 多个 javascript window.open 调用在 chrome 和 IE11 中失败

转载 作者:行者123 更新时间:2023-11-30 05:32:58 24 4
gpt4 key购买 nike

一组多个 window.open() 调用,如 http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_open6 中所述,例如……

    w1=window.open("http://www.google.com/");
w2=window.open("http://www.w3schools.com/");

...在 FireFox 中按预期工作,但在 Chrome 36 和 IE 11 中只打开一个新标签页。

有人知道在 Chrome 和 IE 中实现此功能的方法吗?

最佳答案

我在尝试弹出两个独立窗口时遇到了同样的问题。第二个窗口将替换第一个窗口的链接。我发现答案是给 window 不同的名字。示例:“test1”和“test2”

<html>
<head>
<script type="text/javascript">
window.open("http://www.google.com", "test1", "resizable=no,scrollbars=yes,width=260,height=225");
window.open("http://www.google.com", "test2", "resizable=no,scrollbars=yes,width=260,height=225");
</script>
</head>
</html>

关于javascript - 多个 javascript window.open 调用在 chrome 和 IE11 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25731687/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com