Reputation: 263
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.com", "test", "resizable=no,scrollbars=yes,width=260,height=225");
window.open("http://www.google.com", "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.com/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.
Upvotes: 2
Views: 11349
Reputation: 183
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.com", "test", "resizable=no,scrollbars=yes,width=260,height=225");
}
else{
myWindow.location.href = 'http://www.google.com';
}
</script>
Upvotes: 2