About $variables, $hook,...
By: Arshad
11 Apr 2010Yeah 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.
<?php
if((bool)strpos($_SERVER['HTTP_USER_AGENT'],'iPad')){
//this is iPad
}
else{
//this is not magical and revolutionary ;)
}
?>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.
Hello I'm Arshad. I'm a 21 years old Drupal Web Developer. This is a site i put up for some reasons i can't remember and this is where i write stuffs i need to remember.;)
In the Web world, i head the Drupal Mauritius User Group and the jQuery user Group Mauritius and i'm a campus representative for Mozilla Firefox.
5 Responses to Detecting the iPad with PHP
RobertJ (not verified)
Monday, April 12, 2010 - 07:43 reply
Number 1 on Google for 'Detecting the iPad'. That was quick.
Jonas (not verified)
Monday, April 12, 2010 - 10:53 reply
exactly what i was looking for. thanks alot
Patrick (not verified)
Friday, April 16, 2010 - 20:55 reply
Nice!
Alex (not verified)
Sunday, May 9, 2010 - 17:07 reply
Hey, zats so cool.thanks
Naad (not verified)
Thursday, July 15, 2010 - 10:44 reply
Amazing. Thanks
Post new comment