开发者

IE: window.open returning null

开发者 https://www.devze.com 2023-03-26 04:54 出处:网络
on a click event, I am running this code: win = window.open(a.href); i = setInterval(function () { if (win.closed) {

on a click event, I am running this code:

win = window.open(a.href);
i = setInterval(function () {
    if (win.closed) {
        /* do things开发者_StackOverflow中文版 */
    }
}, 250);

this works fine in Firefox and Chrome, but in IE (9) it says that win is undefined or null. How can I work around this?

EDIT: The window IS opened correctly in IE, it's just that a reference to it is not saved in win like it is in Firefox/Chrome.


Add name to the window:

win = window.open(a.href, "myWin");
0

精彩评论

暂无评论...
验证码 换一张
取 消