iPhone/iPod Touch Detection

So many people are now developing websites that like to deliver specific content if you are viewing from an iPhone or iPod Touch. This can be done using a small snippet of coding that checks the HTTP_USER_AGENT of the browser.

strpos($_SERVER['HTTP_USER_AGENT'], "iPhone");

This code could be used within a conditional statement such as:

<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], "iPhone"))
   echo 'You are using an iPhone';
else
   echo 'You are not usnig an iPhone';
?>



Comments are closed.