IE: window.open returning null

白昼怎懂夜的黑 提交于 2020-01-04 06:22:48

问题


on a click event, I am running this code:

win = window.open(a.href);
i = setInterval(function () {
    if (win.closed) {
        /* do things */
    }
}, 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.


回答1:


Add name to the window:

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


来源:https://stackoverflow.com/questions/6948936/ie-window-open-returning-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!