I'm seeing different behaviour with calls to window.open() when running Internet Explorer as an administrator. I'm not able to reproduce it in a sanboxed iframe environment like jsfiddle/codepen etc. but I'll do my best to explain the issue here.
In IE, not running as an administrator, when I press the button "Empty" it makes a call to window.open("", windowname, ...) and a new blank window appears. Next I press the button "Full" and it makes a call to window.open("http://www.google.com", windowname, ..) and what was the old blank window gets set to Google.
In IE, when running as administrator, the initial blank window isn't overwritten. Instead a new window with Google appears next to the blank window.
I've included my test code below. I'm not sure if the fact that it's in an iframe is relevant but I'm including it just in case
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<iframe src="http://127.0.0.1:8888/">
</iframe>
</body>
</html>
Where the source at http://127.0.0.1:8888/ looks like
<!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>
The behavior of window.open() depends on a few things, especially in Internet Explorer.
Since you are providing a width/height param the browser should open your new window as a popup (if you've got the settings set to allow that) - if you remove the width/height browsers will often open in a new tab instead.
Since your windowname is re-used, and does not contain spaces or hypens, the browser should re-use the same window instance for both. (if you had spaces or hyphens IE would choke and not open the popup (known IE bug)).
"TESTWINDOW" is likely unique enough for this, but also be aware that IE has a bug where if you have another site that tries to call window.open() and they use the same window name as you/your site, the browser will re-use that popup window. IE doesn't properly "namespace" them to a domain (known bug).
Now at one point (IE7/8?) Microsoft changed some behaviors around launching a window with a location of "" (empty string), and/or "about:blank", or "javascript:;" or "javascript:void;" etc. such that they were not trusted at the same level as the domain that opened them. You may be experiencing an issue related to that. (If you use 2 different, but "real" URLs I'd be curious if the behavior is better).
Since the new popup window is a named window, if the iframe or it's parent has a name of "TESTWINDOW" you will get some weird results too.
Finally you indicated that you get different results depending on the logged in user. Since the settings in IE are per user, you may very likely be seeing different settings in action. e.g. does one of your profiles have your domain (or localhost) in the compatibility mode list? or does one of your profiles have different popup blocking rules or privacy settings?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With