WhatIsMyBrowser.com API Blog

Easier formatting of the "simple" strings


We've added some new fields to the API to make it easier for you to display information to your users or employees.

The core goal of the API

The User Agent Parser we've built and the accompanying API originated around the goal of providing really clear, simple to read results about which browser and operating system/platform is being used by your user.

Naturally, our API includes all the very atomic data as well: browser name, version numbers, operating system numbers, so on and so forth. But the real point of difference is that as well as providing this data (which might be useful in grouping or sorting users), we provide a very "human readable" description as well to show to your non technical users or employees.

The "simple" strings

This information is provided in the three API fields:


These three fields form the basis of the homepage of whatismybrowser.com - the large blue section at the top.

This is how we can report something very clear and accurate like: "Chrome 51 on Mac OS X (Mavericks)" or "Android Browser 4 on Android (Gingerbread)" or "Internet Explorer 9 on Windows Vista; Internet Explorer 7 Compatibility View".

In the majority of cases, simple_browser_string is the main one you want to display to your users, but to be complete, you normally also want to include simple_sub_description_string and simple_operating_platform_string if they have values.

But which ones to use?

In some cases, you'll find that there is no simple_sub_description_string but there is a simple_operating_platform_string. Depending on the layout you show to your users, this probably requires some extra logic on your end; to evaluate which one should be shown and in what position or with which styling. In some cases, all three fields have values.

There are a number of possible combinations of which fields have values, depending on your user's set up. For example:

Note that the Android example is showing the Operating Platform in the "secondary" position, but in the IE 8 on HP, the Operating Platform is shown in the "third" position.

Just use these three fields

Figuring out this kind of thing is our job! You just want to use the API and not worry about it too much, so to make your life easier, the API now also contains three more fields:


So now, (for example) all your site needs to do is highlight the simple_major field, show the simple_medium field and perhaps italicise the simple_minor field.


You no longer have to worry about which fields of these have values and which don't to decide how to style them. Typically you can now just check that each field actually has a value, and then output it.

This is what we do on the homepage of whatismybrowser.com and we find it works brilliantly.

The existing simple_browser_string, simple_sub_description_string and simple_operating_platform_string will continue to appear in the API, but these three new "simple" fields hopefully make your life simpler too.

Looking for something else to read? Check out the Developers section of our main site for guides and tools to help you.