I have a Java module that receives the User-Agent string from an end user’s browser needs to behave slightly differently depending on the type of browser, the version of the browser and maybe even the operating system.
E.g.: {"FireFox", "7.0", "Win7"}, {"Safari", "3.2", "iOS9"}
I understood that the User-Agent string can vary in its format for the exact same configuration due to different plug-in installations etc.
My questions:
- Is the structure of the
User-Agentwell defined? If yes – where can I find it exactly? (From my understanding of the RFC there is not much standardization here). - Assuming the question for #1 is
No– is there a proper way to parse it to get the info I need? - Is there a better way to get the info I need other than the
User-Agentstring?
Important note – I’m talking about a web-app, so my data collection abilities are limited to javascript.
For Java, take a look at User-Agent-Utils. It’s fairly compact (< 50kB) and has no dependencies.
Note although the latest release is quite recent (1.21, released 2018-01-24), the library’s page states:
And on the github page it says: