Recommend this page to a friend! | ![]() |
![]() |
All requests ![]() |
> | What is the best PHP detect mobile class? | > | Request new recommendation | > | ![]() |
> | ![]() |
||
by Mark Hoggan - 1 month ago (2015-12-18) detect mobile
+2 | I need a class to detect if the user is using a browser from a mobile device. |
+1 |
There are a few classes for this purpose. This one has been updated recently and can detect other browser capabilities besides detecting whether it is being run on a mobile device or not. |
1. by Mike Siers - 1 month ago (2015-12-23) Reply
download the zip file from mobiledetect.net above and here is the code to detect the type of device.
include_once $_SERVER['DOCUMENT_ROOT'] . '/detect/Mobile_Detect.php';
function deviceType() { $detect = new Mobile_Detect; $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
$_SESSION['DeviceType']=$deviceType;
return $deviceType; }
Recommend package | |
|