S
S
sergeevpetro2018-05-23 00:52:13
PHP
sergeevpetro, 2018-05-23 00:52:13

How to identify a mobile phone with 100% probability?

Hello dear experts!
Actually the question is in the subject, but there is a nuance - desktop Chrome has such a feature joxi.ru/bmoqwkkixyq09A.png
It emulates both the user agent, and the mobile screen size, and the orientation, and the touchscreen.
Are there any options for detecting such a situation?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander Aksentiev, 2018-05-23
@sergeevpetro

https://stackoverflow.com/a/28084346
But in general, not the fact that everything is so simple.

N
Nikolay, 2018-05-23
@iNickolay

With 100% probability - no way

O
Oleg Gamega, 2018-05-23
@gadfi

we do so

export const isMobile = () => {
    if (navigator.userAgent.match(/Android/i)
        || navigator.userAgent.match(/webOS/i)
        || navigator.userAgent.match(/iPhone/i)
        || navigator.userAgent.match(/iPad/i)
        || navigator.userAgent.match(/iPod/i)
        || navigator.userAgent.match(/BlackBerry/i)
        || navigator.userAgent.match(/Windows Phone/i)
    ) {
        return true;
    }
    else {
        return false;
    }
};

M
Maxim Grishin, 2018-05-23
@vesper-bot

No way. The main problem is emulators (or VMs), which in all aspects, including OS, user-agent, screen resolution and even hardware, are mobile phones for an outside observer, in fact - a virtual environment can be executed anywhere.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question