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

标签 javascript internet-explorer google-chrome window.open

一组多个 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/

相关文章:

javascript - 如何设置/检测页面中浏览器 native 搜索生成的突出显示框

带有预编译脚本的 Javascript 模板引擎?

javascript - 与 Moment JS 对比两次

html - 如何使用CSS更改IE8中禁用的html控件的颜色

internet-explorer - 后退按钮(浏览器行为)

javascript - jQuery scrollTop 停止在最新版本的基于 webkit 的浏览器(Chrome 版本 61.0.3163.100)上工作?

google-chrome - Sublime Text 3 + Markdown Preview/Chrome 不渲染数学方程

javascript按钮选择onload

javascript - 欧拉计划 #5 Javascript

css - Internet Explorer 11 打印在右侧剪切文本