Tags

, ,

To detect the iPad, search for the word iPad in the User Agent of super-global variable $_SERVER. Below a very useful snippet of PHP code that detects whether the person viewing your website is on an iPad.

<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPad') !== false) {
    // Found an iPad, do something
}
?>
Advertisements