3 ms·
Mobile has some unique characteristics that don't fully allow agnostic design, namely: - viewport changes size due to soft keyboard - address bar hides/unhides
by thinkloop 6y ago
Mobile has some unique characteristics that don't fully allow agnostic design, namely:
- viewport changes size due to soft keyboard
- address bar hides/unhides during scroll down/up
For certain types of apps, like games, it's important to know whether a device is actually "mobile" regardless of size/resolution. Sniffing user-agents might have to come back into vogue. Who knows where "mobile browsers" will end up - maybe some giant 60" kiosk app, or other places.
Barring that though the article brings up good points and searching the web for how to detect mobile usually brings up the error-prone portrait/landscape resolution detection that the article discusses.
The full solution requires the knowing the resolution and the dpi to get an estimate size of screen in inches. At least with that we can be safe until next article "Just because I'm a 100" kiosk app, doesn't mean I'm on a phone".
Is there a good npm lib that does the above?