Answer the question
In order to leave comments, you need to log in
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
https://stackoverflow.com/a/28084346
But in general, not the fact that everything is so simple.
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;
}
};
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 questionAsk a Question
731 491 924 answers to any question