faisalman / ua-parser-js

"Unmask Your Traffic" - UAParser.js: The Essential Web Development Tool for User-Agent Detection
https://uaparser.dev/
GNU Affero General Public License v3.0
9.28k stars 1.19k forks source link

Android 14 wrongly detected as 10 on some phones #760

Closed stnedelchev-fadv closed 2 weeks ago

stnedelchev-fadv commented 2 weeks ago

Library version v2.0.0-beta.3 and v2.0.0-rc.1

For the issue related with detection result, you can use the demo section in https://uaparser.dev to confirm

Describe the bug Android 14 wrongly detected as 10 on some devices (including my own).

To Reproduce Steps to reproduce the behavior:

  1. Download the latest build (currently 2.0.0 RC1) and use it in an HTML file (or alternatively just open the UA Parser JS demo page.
  2. Try to parse this User Agent "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36"

Expected behavior Since I know I'm on an Android phone with Andriod 14, I would expect the library to detect the OS version as 14

Screenshots

image

image

Smartphone (please complete the following information):

Additional context

Another weird thing is that I see correctly detected OS and device when I first open the demo page (without doing anything)

image

But if I manually pass the same user agent to the manual input below, I get the result that I already described... as if the demo page uses something different initially. I also did a quick google search related to this issue and I found this article that might be related? https://mobiforge.com/research-analysis/the-mysterious-model-k

stnedelchev-fadv commented 2 weeks ago

Closing as I learned that I must use the withClientHints method to get advanced data from browsers that support userAgentData interface

faisalman commented 2 weeks ago

https://docs.uaparser.dev/guides/how-to-identify-android-k-device.html