Article Diary - General Knowledge Digest

PHP Code to Detect iPhone and iPad

Here is the PHP code to detect if a user is browsing your website from iPad or iPhone. If you want to detect iPad and iPhone browser then following snippet will help you to redirect users to new page specifically designed for iPhone or iPad devices.
PHP iPad Detection Code
if(strstr($_SERVER[’HTTP_USER_AGENT’],"iPad"))
{
header("Location: http://ipad.yourdomain.com");
}
?>
PHP iPhone Detection Code
if(strstr($_SERVER[’HTTP_USER_AGENT’],"iPhone"))
{
header("Location: http://iphone.yourdomain.com");
}
?>
Attached Files
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Name
Email
Security Code Security Code
Related Articles RSS Feed
Acer Aspire 5740G Review - 15.6" Intel Core i5 Laptop
Viewed 0 times since Thu, Jul 15, 2010
Google Buzz - What it is all about?
Viewed 2935 times since Fri, Feb 12, 2010
World's Youngest Microsoft Certified Systems Engineer
Viewed 1882 times since Wed, Feb 10, 2010
Increase Your Internet Speed Instantly
Viewed 1405 times since Mon, Feb 15, 2010
Google Goggles
Viewed 1414 times since Fri, Dec 11, 2009
Microsoft Outlook 2002 and Outlook 2003: Resetting Microsoft Outlook's 'nickname cache'
Viewed 2006 times since Sat, Mar 27, 2010
File Upload in PHP - PHP File Upload Script
Viewed 2741 times since Thu, Nov 5, 2009
Top 5 Business Laptops - April 2010
Viewed 1328 times since Sat, Apr 3, 2010
MENU