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
World's Youngest Microsoft Certified Systems Engineer
Viewed 1112 times since Wed, Feb 10, 2010
Turn Your Handwriting Into Font With YourFonts
Viewed 786 times since Mon, Nov 16, 2009
How do I add and register extra domain names?
Viewed 2243 times since Fri, Oct 9, 2009
Top 5 Business Laptops - April 2010
Viewed 707 times since Sat, Apr 3, 2010
8 Ways to Overcome Your Fear of Outsourcing
Viewed 1014 times since Wed, Nov 25, 2009
Windows XP, Windows Vista, Windows 7: Clear Icon Cache
Viewed 930 times since Sun, Mar 28, 2010
MENU