Javascript window.open returns null in 32-bit IE8 on Win7 x64

后端 未结 3 1179
無奈伤痛
無奈伤痛 2021-01-12 06:44

I have read the related questions on this topic, but haven\'t yet found a solution to this issue. I have a simple javascript function that calls window.open when a link is

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-12 07:42

    Internet Explorer seems to return null if the url is outside your current domain. You can work around it by open an empty page first, then navigate the window to the actual url:

    var newwindow;
    function pop(url)
    {
        newwindow=window.open('','','height=500,width=532');
        newwindow.location = url;
    
        if (window.focus) {newwindow.focus();}
    }
    

提交回复
热议问题