PHP Ipad and Iphone detection

Home » Blog » Resources » PHP » PHP Ipad and Iphone detection

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

[PHP]
if(strstr($_SERVER['HTTP_USER_AGENT'],"iPad"))
{
header("Location: http://ipad.yourdomain.com");
}
?>
[/php]

PHP Iphone detection code

[PHP]
if(strstr($_SERVER['HTTP_USER_AGENT'],"iPhone"))
{
header("Location: http://iphone.yourdomain.com");
}
?>
[/php]

One Comment on "PHP Ipad and Iphone detection"

  1. jehzlau says:

    This is really useful. I’ll implement this in my blog soon. I just need to create a template for ipad and iphone. I’m already using an WP PDA plugin and it works great for iPhone. :)

    Reply →

Got something to say? Go for it!

CommentLuv badge