IE9 lost controlling on child window
I have some javascipt that open 2 pop up windows with the similar code:
Child[i] = window.open(...);
And then I try to close all of them from Main window with the following code:
setTimeout(Child[i].close(), 5000);
The problem is in IE9, the 2 pop up can't be closed, it seem like the main window totally lost control on 2 pop up (child window), but this only happen when 2 URL is real URL, I mean the URL target to a real website (e.g. google.com), on the other hand if the URL is about:blank
, so the pop up are c开发者_StackOverflow中文版losed after 5 secs (which work as expect).
In Chrome, the script work great no matter what is the URL.
I have no idea what is this behaviour of IE, so hope to receive some help from you. Thank you!Try setting this before closing:
Child[i].opener = window;
Child[i].close();
Note: This works in IE < 9, haven't tried on 9 yet.
Another thing I just noticed, change your setTimeout
call to this and try:
setTimeout(function() {
Child[i].opener = window;
Child[i].close();
}, 5000);
精彩评论