Detecting the iPad with PHP

Yeah that's right. You have another device to worry about next time you want launch that big hit of a website you've been brewing for month. It's the iPad.

The iPad might not be exactly ipod touch's big brother but it does come with a browser twice as large as the ipod/iphone. For developers it's another agent we must take care of. Why? Because it opens up new opportunities for developers and there's thousands of hungry app consumers waiting for your next tap tap revenge. It's crazy. As Jobs puts it : "...If you're a dev, that's a plum market to go after...".

So here's how you can detect if the user visiting your site is on an ipad or not.{syntaxhighlighter brush: php;fontsize: 100; first-line: 1; }<?php
if((bool)strpos($_SERVER['HTTP_USER_AGENT'],'iPad')){
//this is iPad
}
else{
//this is not magical and revolutionary ;)
}
?>{/syntaxhighlighter}

You can use this to redirect users to a different version of you website or provide an html5 video interface instead of  grumpy old Flash.

Comments

Number 1 on Google for 'Detecting the iPad'. That was quick.

exactly what i was looking for. thanks alot

Nice!

Hey, zats so cool.thanks

Amazing. Thanks

Add new comment