Created
June 19, 2012 19:01
-
-
Save yurivictor/2955904 to your computer and use it in GitHub Desktop.
iPhone detection function (PHP)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function iOSDetect() { | |
$browser = strtolower( $_SERVER['HTTP_USER_AGENT'] ); | |
if( strstr( $browser, 'iphone' ) || strstr( $browser, 'ipod' ) ) | |
$device = 'iphone'; | |
return( $device ); | |
} | |
iOSDetect(); | |
if ( $device == 'iphone' ) | |
echo 'iphone'; | |
else | |
echo 'default'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment