isMobile is not that useless. It's not that trivial to create this function yourself. But the code is just bunch of regex that tests userAgent string. It don't look very reliable. In one of my projects I have very long regex that test if something is mobile or even longer if it's a tablet.
isMobile is not that useless. It's not that trivial to create this function yourself. But the code is just bunch of regex that tests userAgent string. It don't look very reliable. In one of my projects I have very long regex that test if something is mobile or even longer if it's a tablet.
In my personal experience is better check the viewport size (i.e: with window.matchMedia)
I think that it fail on iPhone with retina in horizonntal mode. vewport size is not best way to test for mobile.
I think not, because the viewport pixels is not based on the real pixels of the device. You can also test and share your results ;)
Here is some documentation about how the CSS Units works webplatform.github.io/docs/tutoria...