Created
June 7, 2018 08:54
-
-
Save w-jerome/993c97e1714e302af710156b5223f9ea to your computer and use it in GitHub Desktop.
PHP — Detect is mobile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$is_mobile = false; | |
if (preg_match('/(android|webos|avantgo|iphone|ipad|ipod|blackberry|iemobile|bolt|boost|cricket|docomo|fone|hiptop|mini|opera mini|kitkat|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $_SERVER['HTTP_USER_AGENT'])) { | |
$is_mobile = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment