hisorange / browser-detect

Browser Detection for Laravel by hisorange!
https://browser-detect.com
MIT License
1.08k stars 143 forks source link

Phone's user agent returns true on isTablet #177

Closed suzakuchris closed 2 years ago

suzakuchris commented 2 years ago

Hello, I tried this library on my mobile phone (Xiaomi note series), which has this user agent

Mozilla/5.0 (Linux; Android 10; Redmi Note x Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Mobile Safari/537.36 and it returns true on isTablet even though its not a tablet, is there any planned fix or available workaround for this? thanks.

hisorange commented 2 years ago

Aye there, sadly the detection is not 1:1 which means that it is not possible to individually fix for each device because it would slow down the system to a halt.

The detection is based on pattern matching and are executed by underlying detectors, in this case the isTablet coming from a detector which sees this as phablet.

In your case I would advise to handle the tablets and mobiles in the same way, because modern phones have bigger screen and better resolution than many tablet.

suzakuchris commented 2 years ago

ah, gotcha, thanks for responding, its a pretty good library you made, but I guess its true that we can't really detect everything for every edge cases, I'll see what I can do about it, maybe via CSS' breakpoint instead of PHP

hisorange commented 2 years ago

Yep yep! Breakpoints are much better solution, I only made this lib so pages which have a mobile and desktop version for optimalization can detect on server level and redirect the visitor without first loading a 200mb javascript on their mobile :D

Anyways, have a great day!