In principle, it does not matter, maybe the server, and the client side can check. The only question is how to do it.

  • Already it was, tyts - Zowie

6 answers 6

Check the contents of navigator.userAgent for the presence of the substrings "iphone", "android", "blackberry", "webos", etc.

    Yandex has a good API for defining mobile devices: the Yandex.Dector API .

    PI Yandex. Detector provides the ability to determine the model and characteristics of a mobile device of a website user by the HTTP request headers sent by the browser of his device.

      You can fake the device easily, not an option. If on the client side, you can check the screen size on js. As you understand, the phone or smartphone will have a smaller screen than a PC. Immediately I will give a favor, and then themselves

       <script> width=screen.width; // ширина height=screen.height; // высота alert ("Разрешение экрана: "+width+"x"+height); </script> 

        An example in php (can someone come in handy in the future). Taken from this site . I use it on my projects - it works.

         // определение мобильного устройства function check_mobile_device() { $mobile_agent_array = array('ipad', 'iphone', 'android', 'pocket', 'palm', 'windows ce', 'windowsce', 'cellphone', 'opera mobi', 'ipod', 'small', 'sharp', 'sonyericsson', 'symbian', 'opera mini', 'nokia', 'htc_', 'samsung', 'motorola', 'smartphone', 'blackberry', 'playstation portable', 'tablet browser'); $agent = strtolower($_SERVER['HTTP_USER_AGENT']); foreach ($mobile_agent_array as $value) { if (strpos($agent, $value) !== false) return true; } return false; } // пример использования $is_mobile_device = check_mobile_device(); if($is_mobile_device){ echo "Вы зашли с мобильного устройства"; }else{ echo "Вы зашли с PC"; } 

          The browser sends to the server quite detailed information about itself, and already on the server side this info can be checked ...

          • and on the client side? - Smash
          • On the client side there is javascript - triplustri