iPad Safari IOS 5 window.close() closing wrong window

前端 未结 3 1361
傲寒
傲寒 2021-01-12 02:23

We have an iPad application that\'s working on our older iPads.

We open external links using var x = window.open(url)

at the end of the day, when the user cl

3条回答
  •  花落未央
    2021-01-12 02:45

    That did the trick for me (iPad 2 and 3; 3 with iOS 5.1.1)

    var host=window.opener;
    window.focus(); /* solves the iPad3 problem */
    window.close(); /* the actual closing we want to achieve... */
    /* makes the focus go back to opener on iPad2, fails silently on iPad3 */
    try { host.focus(); } catch(e) {} 
    

提交回复
热议问题