Is there a possible way of adding to the script below so it will detect all touch screen phones and all non touch screen phones?
// Checks the users device and if a mobile device, it redirects them too the mobile version of our site
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
if ($berry == true)
{
header('Location: http://mobile.example.co/');
}elseif($iphone || $android || $palmpre || $ipod == true){
header('Location: http://touch.example.co/');
}
This is not really a PHP problem 😉
There is no easy solution sadly, but you can have a look at this : http://wurfl.sourceforge.net/.
It’s a database of user agents and their properties. It should have a field for touch screen inside.