I have a web site that uses a popup using js but on iphones, its impossible to close the pop up. So I need some php so that when someone visits the site on an iphone, the script executing the popup will be hidden.
Something like this should be able to do it < ?php $browser = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); if ($browser == false) { echo 'Code You Want To Execute'; } ?>
Put your popup code in a js function and test before you run it: if ( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) ) { return; }
Thanks for your help guys. I looked around also and in the end I made it like this to cover my bases. <?php //hide aweber from iphone, ipad and ipod $isiphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $isipad = strpos($_SERVER['HTTP_USER_AGENT'],'iPad'); $isipod = strpos($_SERVER['HTTP_USER_AGENT'],'iPod'); if ($isiphone == false || $isipad == false || $isipod == false) { echo '<script type="text/javascript" src="my aweber url"></script>'; } ?> PHP: