0

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!

LJ Wadowski
  • 6,424
  • 11
  • 43
  • 76
  • Why are you opening up a new window to just close it? Why not make an Ajax request? No pop ups to deal with.No pop up blockers to block it. – epascarello Feb 27 '15 at 13:42
  • I am opening it to solve cross domain 3dr party cookie issue in safari (I have to open this popup from inside of iframe to set cookie, because safari does not allow me to set cookies straight by iframe) and everything works but the close. – LJ Wadowski Feb 27 '15 at 13:45
  • @epascarello AJAX inside of iframe will not set cookies as well. – LJ Wadowski Feb 27 '15 at 13:51
  • If it is a 3rd party site, than Cross Domain policy should not let you open up window and close it. – epascarello Feb 27 '15 at 13:55
  • But It showing popup on user interaction (click) so it is allowed. And whole concept works everywhere else except iOS 8.1 – LJ Wadowski Feb 27 '15 at 13:57

0 Answers0