javascript

Detecting iPad

Need to tell if a user is browsing your site on an iPad? Here’s how to do so via PHP: <?php define(‘IS_IPAD’, (bool)strpos($_SERVER[‘HTTP_USER_AGENT’],’iPad’)); ?> One can also do it via Javascript: <script> var IS_IPAD = navigator.userAgent.match(/iPad/i) != null; </script> However, I prefer making the determination server-side, as there’s a (small) number of users who browse […]