As you can see from the examples on the previous page, User Agent strings typically start off with the name of the product (the browser, that is) and a version number. That information is sometimes followed by a list of comments in parentheses, one of which usually indicates the operating system.
Here are a few more examples:
User Agent: NCSA Mosaic/2.6b1 (X11;UNIX_SV 4.2MP R4000) libwww/2.12 modified
User Agent: Mozilla/3.0 (compatible; Opera/3.0; Windows 95/NT4)
User Agent: Lynx/2.7 libwww-FM/2.14
You can also see from the irregularity of these examples that it's not a trivial task to come up with a parsing algorithm that will identify browsers (and platforms) correctly. In fact, there's nothing stopping an individual from building a browser that completely defies the vague conventions presented above. To make things worse, there's always a certain type of person who enjoys spoofing User Agent strings of other browsers or making up their own. Nadav's favorite from our HotBot logs was:
User Agent: Nintendo64/1.0 (SuperMarioOS with Cray-II Y-MP Emulation)
Are you still bold enough to try writing your own browser-detection routine? Keep reading for a few rules of thumb.
next page»