Any way to detect android device type (phone/pad) in firefox

109 Views Asked by At

The userAgent of Chrome and Edge, both contains a 'Mobile' word on android phone. And don't contains it on android pad.

But the Firefox userAgent on phone is exactly alike it on pad.

So, is there any accurate way to detect the android device type for Firefox?

1

There are 1 best solutions below

1
On

I think the only way to do that is detect with size of device because tablets are basically bigger then phones

hope something like this could help :

let isMobile = window.matchMedia("only screen and (max-width: 760px)").matches;
if (isMobile) {
    //Conditional script here
}