What is the simplest way to tell if a user is using a mobile device to browse my site using PHP?
I have come across many classes that you can use but I was hoping fo
Maybe combining some javascript and PHP could achieve the trick
';
$string .= 'if ( /Opera|OPR\/|Puffin|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { ';
$string .= ' alert("CELL")';
$string .= ' } else {';
$string .= ' alert("NON CELL")';
$string .= ' } ';
$string .= '';
echo $string;
?>
I used that with plain javascript also instead