javascript - IE11 on WIN 8.1 : window.open with the same name is opening new popup window - Stack Overflow

When running the below HTML page it is opening two popup windows. It is not the case with previous vers

When running the below HTML page it is opening two popup windows. It is not the case with previous versions of IE. When window.open call is made with the same window name that has already opened, it should return the reference to the opened window. But in IE11 it is opening another new window.

<html>
<head>
<script type="text/javascript">
window.open("", "test", "resizable=no,scrollbars=yes,width=260,height=225");
window.open("", "test", "resizable=no,scrollbars=yes,width=260,height=225");
</script>
</head>
</html>

This behavior is not happening, if you not mentioned a url. (See below html page). Below html page is launching only one popup window.

<html>
<head>
<script type="text/javascript">
window.open("", "test", "resizable=no,scrollbars=yes,width=260,height=225");
window.open("", "test", "resizable=no,scrollbars=yes,width=260,height=225");
</script>
</head>
</html>

When we provide url or navigate to url window is losing its name. If you try to get the popup window name using window.name it is returning empty string.

It is happening only in Windows 8.1 and IE 11 and not happening in Windows 7 and IE11. Are there any tweaks I need to do to make this work in IE11?

Update: It seems to be IE bug. IE team is investigating it.

Update 2: It is happening only if Internet Explorer runs in elevated mode.

When running the below HTML page it is opening two popup windows. It is not the case with previous versions of IE. When window.open call is made with the same window name that has already opened, it should return the reference to the opened window. But in IE11 it is opening another new window.

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

This behavior is not happening, if you not mentioned a url. (See below html page). Below html page is launching only one popup window.

<html>
<head>
<script type="text/javascript">
window.open("", "test", "resizable=no,scrollbars=yes,width=260,height=225");
window.open("", "test", "resizable=no,scrollbars=yes,width=260,height=225");
</script>
</head>
</html>

When we provide url or navigate to url window is losing its name. If you try to get the popup window name using window.name it is returning empty string.

It is happening only in Windows 8.1 and IE 11 and not happening in Windows 7 and IE11. Are there any tweaks I need to do to make this work in IE11?

Update: It seems to be IE bug. IE team is investigating it. https://connect.microsoft./IE/feedback/details/797964/ie11-win-8-1-window-open-with-the-same-name-is-opening-new-popup-window#details

Update 2: It is happening only if Internet Explorer runs in elevated mode.

Share Improve this question edited Feb 15, 2014 at 18:18 Suresh asked Aug 22, 2013 at 6:19 SureshSuresh 2632 gold badges4 silver badges13 bronze badges 9
  • Look at settings. Perhaps there is one saying "Always open new windows in new tab" – mplungjan Commented Aug 22, 2013 at 6:25
  • Hi mplungjan, If I select that setting, then window.open call opening it in new tab, But I want it to be opened in new window. – Suresh Commented Aug 22, 2013 at 6:32
  • I meant: UNCHECK that if it is checked – mplungjan Commented Aug 22, 2013 at 6:39
  • The "CONNECT" bug you cited in your update implies that you're crossing URLMon security zones, so you lose the reference to the window. Your code SHOULD work if the original page and the popup window are in the same security zone. – EricLaw Commented Oct 11, 2013 at 19:54
  • @EricLaw, other browser doesn't have this problem. Why is IE always doing something different??? – Grant Zhu Commented May 13, 2014 at 3:12
 |  Show 4 more ments

1 Answer 1

Reset to default 2

Please try this.. this will check the window is still open or closed..

<script type="text/javascript">
 var myWindow = null;

 if(!myWindow || (myWindow && myWindow.closed)){
 myWindow = window.open("http://www.google.", "test", "resizable=no,scrollbars=yes,width=260,height=225");
          }
         else{
       myWindow.location.href = 'http://www.google.';
       }

</script>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745352349a4623909.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信