-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.toString() returns Android 0.0.0 for Android 9 devices #130
Comments
It probably means that there isn't a suitable parser yet for this user-agent string. Once it will be added to the https://github.com/ua-parser/uap-core project, it would parse, and stringify correctly. |
@3rd-Eden Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G975N Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/9.2 Chrome/67.0.3396.87 Mobile Safari/537.3 I have checked that if the useragent string does not display as Android {major version}.{minor version}, it will be parsed and verified that no version is output. Is there an interface that can be customized to deal with It? |
Just a head's up that this is also affecting Android 11 on Google Pixel 2: My guess is that it's due to an expectation of the Android version number having a major and minor number, not just a major. By adding a ".0" to the end of the Android version, I get desirable results. > const {parse} = require('useragent');
undefined
> parse('Mozilla/5.0 (Linux; Android 11; Pixel 2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.101 Mobile Safari/537.36').os
OperatingSystem {
family: 'Android',
major: '0',
minor: '0',
patch: '0'
}
> parse('Mozilla/5.0 (Linux; Android 11.0; Pixel 2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.101 Mobile Safari/537.36').os
OperatingSystem {
family: 'Android',
major: '11',
minor: '0',
patch: '0'
} |
I tested on Android 11, 12 and 14 and I also had this issue |
Parsing the header 'Mozilla/5.0 (Linux; Android 9; Pixel XL Build/PPR1.180610.009) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.91 Mobile Safari/537.36' and then calling .toString() to get the human readable form results in 'Chrome Mobile 68.0.3440 / Android 0.0.0' and not Android 9 as expected.
The text was updated successfully, but these errors were encountered: