Search code examples
loggingbrowseruser-agent

Useragent string doesn't contain browser name


I've been seeing a lot of this useragent in my logs from a webapp: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) . As the user agent doesn't contain any browser name, is there a way to tell what browser and version user was using? Also, does anyone know what this user agent is? The operating system seems to be macOS X 10.13.6, but beyond that, there is no information on what the browser is.


Solution

  • Sadly there is no magic bullet to do what you want. You have to look up the values of the User-Agent using a list of known User-Agents. There are several resources on the web, one of which is https://deviceatlas.com/blog/list-of-user-agent-strings but you should know that you will have to keep updating your list periodically as browsers are updated and released.

    For your sample and using the site above, Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) would be Mac OX X-based computer using Safari and AppleWebKit/605.1.15 (KHTML, like Gecko) would be Apple iPhone XR (which is Safari).

    There are many great JavaScript libraries that have this functionality, and a great site to find links to many of them is: https://www.whatsmyua.info/ - visit the site and it will show you the parsed User-Agent information about your browser, and it will give you links to many JavaScript libraries that will parse the value.