serbanghita / Mobile-Detect

Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
http://mobiledetect.net
MIT License
10.55k stars 2.68k forks source link

Not Work Properly #929

Closed hafizulshaikh42 closed 1 year ago

hafizulshaikh42 commented 1 year ago

Please specify the User-Agent. Go to https://demo.mobiledetect.net and copy-paste it here. This projects does not get proper value.

Suleman-Elahi commented 1 year ago

It only doesn't work in Chrome based browsers. Works file in MS Edge and DuckDuckGo

photocoder commented 1 year ago

Doesn't detect Chrome: https://demo.mobiledetect.net/ shows: This is a computer. Your UA is Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36

Doesn't detect Safari: This is a computer. Your UA is Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.2 Safari/605.1.15

Doesn't detect Firefox: This is a computer. Your UA is Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/110.0

Doesn't detect Edge: This is a computer. Your UA is Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82

All is..functions are false and isChrome(), and isSafari(), etc

serbanghita commented 1 year ago

@hafizulshaikh42 @Suleman-Elahi @photocoder the reason why it detects false is because the library only looks for "mobile" versions of Chrome. The library is not meant to detect regular desktop versions.

Also see: https://github.com/serbanghita/Mobile-Detect/blob/3.74.x/docs/KNOWN_LIMITATIONS.md