/ Published in: PHP
URL: http://www.iphonemicrosites.com/tutorials/php-auto-bowser-detection/
References: http://us3.php.net/function.get-browser http://us2.php.net/strpos
http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html
http://stackoverflow.com/questions/186734/how-do-i-detect-mobile-safari-server-side-using-php
Expand |
Embed | Plain Text
< ?php $browser = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone") || strpos($_SERVER['HTTP_USER_AGENT'],"iPod"); if ($browser == true) { echo 'Code You Want To Execute'; } ?> or <?php ?> More advanced method that detects Mobile Safari: <?php /* detect Mobile Safari */ $browserAsString = $_SERVER['HTTP_USER_AGENT']; { $browserIsMobileSafari = true; } ?>
You need to login to post a comment.
