Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does a database of user-agent to browser brand mappings exist?

In my application I would like to save user's last used browser to avoid spending lot of time on the phone with users trying to find out whether they are using an IE7 or and IE8. Storing user agent string would probably be just fine for me, however, if possible, I would like to store and show only the brand name and version, i.e. something readable for "normals" humans like "Mozilla Firefox 3.6".

So my question is: is there a database of some kind which collects user agent strings and maps them to brand names and provides the data as something I could use in development? If not, do you know of any mature software which parses the user agent string and returns a brand name?

like image 567
Nikolai Prokoschenko Avatar asked Oct 11 '22 08:10

Nikolai Prokoschenko


1 Answers

The brand name and version could quite easy be parsed out from the user agent string using regex or simple string search.

Here's a regex example for catching Browser & version. You might want to map "MSIE" to "Internet Explorer" or something.

(MSIE|Firefox|Chrome)(\s|\/)(\d{1,3}\.\d)

But otherwise you can find list like this used for the "user agent switcher plugin" in FireFox or this list with only mobile browsers. The first link gives a description matched for almost all user agents/browses.

like image 145
Ragnar Avatar answered Oct 14 '22 03:10

Ragnar