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

NPM package version withClientHints incorrect #739

Closed cgh20xx closed 3 months ago

cgh20xx commented 4 months ago

Library version v2.0.0-alpha.3

UA String: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36

Describe the bug I used npm i ua-parser-js@2.0.0-beta.3, but the information obtained with UAParser().withClientHints() is incorrect. The device.model shows as "K". However, when using the detection on the official website (https://uaparser.dev/), the result is correct, with device.model showing as "SM-S9060". I noticed that the JS version on the official website (https://uaparser.dev/js/ua-parser.js) is also 2.0.0-beta.3. Why is there a discrepancy in the results when using the same version?

Smartphone (please complete the following information):

faisalman commented 4 months ago

Hi @cgh20xx can you provide a working example that we can investigate? also check for the URL, since Client Hints are only sent when you browse from a secure context (https:// or localhost).^1

cgh20xx commented 3 months ago

Thank you. It's working fine now that I'm using HTTPS.