小编car*_*son的帖子

以管理员身份运行Internet Explorer 11时的不同window.open(...)行为

当我以管理员身份运行Internet Explorer时,我看到了对window.open()的调用的不同行为.我无法在jsfiddle/codepen等sanboxed iframe环境中重现它,但我会尽力在这里解释这个问题.

在IE中,没有以管理员身份运行,当我按下"清空"按钮时,它会调用window.open("",windowname,...)并出现一个新的空白窗口.接下来,我按下"Full"按钮,它会调用window.open(" http://www.google.com ",windowname,..)以及旧的空白窗口设置为Google的内容.

在IE中,以管理员身份运行时,不会覆盖初始空白窗口.相反,空白窗口旁边会出现一个带有Google的新窗口.

我在下面提供了我的测试代码.我不确定它在iframe中的事实是否相关,但我包括它以防万一

<!DOCTYPE html>
<html>
  <head>  
  </head>
  <body>
    <iframe src="http://127.0.0.1:8888/">
    </iframe>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

来自http://127.0.0.1:8888/的来源看起来像

<!DOCTYPE html>
<html>
<head>
  <script type="text/javascript">
    var windowname = "TESTWINDOW";
    var features = "menubar=no, location=no, resizable=yes, status=yes, width=500, height=500";

    function doEmpty(e) {
      window.open("", windowname, features);
    }

    function doFull(e) {
      window.open("http://www.google.com", windowname, features);
    }
  </script>

  <style>
    body {
      width: 1000px;
      height: 1000px;
    }
  </style>
</head>

<body>
  <button onclick="doEmpty()">Empty</button>
  <button onclick="doFull()">Full</button>
</body>

</html>
Run Code Online (Sandbox Code Playgroud)

html javascript iframe internet-explorer-11

8
推荐指数
1
解决办法
924
查看次数

标签 统计

html ×1

iframe ×1

internet-explorer-11 ×1

javascript ×1