I am trying to detect when iPad and iPhone users are using a version of iOS prior to iOS6, and display a message to them that they need to upgrade to iOS6 in order to get a certain feature.
I thought the code below would work, but I am using an iPad with iOS 6.0.0 and yet I am still getting into the code black to display the upgrade message.
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
$Android= stripos($_SERVER['HTTP_USER_AGENT'],"Android");
$webOS= stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
//do something with this information
if( $iPad || $iPhone &&
(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone OS 6_0') == false &&
strpos($_SERVER['HTTP_USER_AGENT'], 'OS 6_0') == false)){
//some code to let user know this feature is not available for older versions of ios
}
Found this here:
Should work. Reverse to do something if it is not iOS6, like displaying the upgrade message.