Archive for the ‘Mozilla’ Category

Tip: How to detect with PHP if iPhone visits your site

Saturday, January 30, 2010 2:17 1 Comment

Currently I’m developing some websites which “can be visited from iPhone” [the customer say that], the big thing is: there are some javascripts functions to detect it but when you use it with jQuery this “lock” the effects.
The solution is so easy, you just need to use this PHP script:
PHP<5.3.0

if (ereg('iPhone',$_SERVER['HTTP_USER_AGENT']))
{
header("Location:/iphone.html");
}

PHP>=5.3.0

if (preg_match("/iPhone/",$_SERVER['HTTP_USER_AGENT']))
{
header("Location:iPhone.php");
}

Take Care: Is Important [...]

This was posted under category: Cómo, Mozilla, PHP, Programación, Tips, iPhone