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");
}
?>
5 (1)
Article Rating (1 Votes)
Rate this article
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
Turn Your Handwriting Into Font With YourFonts
Viewed 1318 times since Mon, Nov 16, 2009
Google Adsense
Viewed 1359 times since Sat, Feb 6, 2010
Acer Aspire 5740G Review - 15.6" Intel Core i5 Laptop
Viewed 0 times since Thu, Jul 15, 2010
Windows XP, Windows Vista, Windows 7: Clear Icon Cache
Viewed 1371 times since Sun, Mar 28, 2010
Windows 7 Secret God Mode
Viewed 1316 times since Fri, Feb 26, 2010
Article Templates
Viewed 1273 times since Sat, Jan 2, 2010
Ubuntu LAMP Server Installation
Viewed 1389 times since Tue, Feb 23, 2010
Google Goggles
Viewed 1276 times since Fri, Dec 11, 2009