With LinkedIn you can see a list of sessions, and sign them out from a distance.
Within that list you can see a human readable way what kind of device / browser combination you used for that session.
The current state of UserAgent strings is quite a mess.
Question: Is there a reliable way (or library) to extract this information clean and reliable from the user agent string?
What I'm trying to prevent
One big hairy ball of spaghetti with 30 if ( str.contains("yadadaya")
under each other that have to tested and that will most likely break or go out of date really fast.
Looking for something preferably in C# or JavaScript
A browser's User-Agent string (UA) helps identify which browser is being used, what version, and on which operating system. When feature detection APIs are not available, use the UA to customize behavior or content to specific browser versions.
The user-agent string of the browser is accessed using the navigator. userAgent property and then stored in a variable. The presence of the strings of a browser in this user-agent string is detected one by one. Detecting the Chrome browser: The user-agent of the Chrome browser is “Chrome”.
Described in the HTTP standard, the User-Agent string contains a number of tokens that refer to various aspects of the request, including the browser's name and version, rendering engine, device's model number, operating system and its version, etc.
The User-Agent (UA) string is contained in the HTTP headers and is intended to identify devices requesting online content. The User-Agent tells the server what the visiting device is (among many other things) and this information can be used to determine what content to return.
You probably want something like ua-parser-js or uap-csharp.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With