Cannot close popup() window in iPhone Safari

六眼飞鱼酱① 提交于 2019-12-12 00:01:28

问题


I wrote a simple script which should close popup window opened by user click (onclick). However, it does not work in Apple iPhone device which I use to test (iOs 8.1), but seems to work everywhere else.

I found an information about bug in safari HERE

but I wonder is there any workaround which can help make it work for people who using version 8.1?

function popitup(url, windowName) {                      
    var newwindow = window.open(url, windowName, 'height=10px,width=10px,top=5000,left=5000,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,channelmode=0,directories=0,fullscreen=0');      
    newwindow.addEventListener('load', function() {   
       //close popup                                 
       newwindow.close();
       window.focus();
       //redirecting main window
       window.location.href = "<?php echo $site_url; ?>/gt/ts";            
    });
    return false;
}

Thanks!

来源:https://stackoverflow.com/questions/28766482/cannot-close-popup-window-in-iphone-safari

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