Who do you want to be today?
Only your user-agent knows for sure.

by Jos Claerbout
Web Engineer, WebTV Networks, Inc.
October 23, 1998

A tidbit from "The Curse of Monkey Island":

Guybrush: What's your name?
Slappy Cromwell: Cromwell, Slappy Cromwell. It's not my real name actually. My agent told me my given name just didn't have star quality.
Guybrush: What was your given name?
Slappy Cromwell: Rex Fortune, Adventure Seeker.

People have a sentimental attachment to their names. It may surprise you, then, that names play a large role in an environment as emotionless as Internet architecture. Every time that your Web browser requests a page, it’s revealing a name and an address. Now, before you get all squeamish that people are going to find out that you were visiting Bored.com, I should note that your browser isn't giving out your name, but rather its own name and IP address.

This browser name is called a "user-agent string". This name may not look like "Fanny O’Browser" or "Alexander Webbiecakes", but it’s a legitimate name nonetheless. Like the name "Rex Fortune, Adventure Seeker", user-agent strings give Web servers an indication of what a browser is capable of. Some examples of user-agent strings:

  • Netscape Navigator: Mozilla/4.05 [en] (WinNT; U)
  • MSIE: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)

Between them, these two browsers account for 85%-90% of the market. There are, however, dozens more. Browserwatch.com lists pages and pages of  browsers, from Ariadna, a Russian-only browser, to Hexabit Junior, a browser designed just for kids. Each one of these browsers has a unique user-agent string.

So why do servers insist of retrieving these user-agent strings from browsers that visit them? Two main reasons:

  • To track the browser and operating system of site visitors for use in design decisions
  • To deliver specific content to users according to the capability of their browsers

So, You Want to Write a User-Agent ...

Which brings us around to WebTV. When our engineers coded the first WebTV  browser, they had to come up with a user-agent string that the browser could use to send to sites. How to do it?

Well, the true geeks in the audience will want to refer to the HTTP spec, but I'll give you the juicy tidbits to save you the trouble:

"The [user-agent string] can contain multiple product tokens and comments identifying the agent and any subproducts which form a significant part of the user agent."

What's a "product token"?

"Product tokens should be short and to the point -- use of them for advertising or other non-essential information is explicitly forbidden."

Sorry folks, but the user-agent string

Eat at Joes 4.0/WinNT(compatible: Pepsi is the choice of a new generation;2.5)

just ain't going to fly with the good folks at the W3C. And you don't want to mess with them; they're international.

Given the guidelines above, WebTV chose a user-agent string that well described its browser:

Mozilla/3.0 WebTV/1.2 (compatible; MSIE 2.0)1

This user-agent string identifies both the particular WebTV version (1.2 in this case) as well as saying that the browser is compatible with Netscape 3.0 (Mozilla) and IE 2.0 (it would say IE 3.0, but WebTV doesn't support VBScript)

It Gets More Complicated ...

WebTV users access the Internet through proxy servers, which are never sure exactly what version of WebTV sent the request. Due to this, the user-agent string that is sent via HTTP is a  "catch all" for the oldest possible WebTV browsers that are out there.

Mozilla/3.0 WebTV/1.2 (compatible; MSIE 2.0)

This means that if your site is trying to block older versions of the WebTV browser, you will be unable to determine this with the user-agent string returned via HTTP. To get the user-agent string of a specific WebTV box, you must instead use JavaScript, as that information will return directly from the client box, rather than the proxy server. Note that there are some small eccentricities in the user-agent strings returned via Javascript.

User-agent string for the current WebTV Plus build:

Mozilla/3.0 WebTV/2.2.2 (Compatible; MSIE 2.0)

User-agent string for the current WebTV Classic build:

Mozilla/3.0 WebTV;1.4 (Compatible MSIE 2.0)

So How Did We Get On This Topic In the First Place?

There are hundreds of different user-agents floating around on the Web, identifying themselves as anything from "ANT Fresco-1.72/Mozilla-Spoofer Mozilla/2.02 (compatible; ANT Fresco/1.72; RISC OS 3.70)" to "ZzZ". User-agents serve as another reminder that even though you must have an identity on the Internet, that identity can be anything you want. As Rebecca Pidgeon said in the Spanish Prisoner, "You never know who anybody is, except me. I am who I am."

Really.


1The WebTV Viewer, because it is not running through the WebTV proxy servers, will return an inaccurate HTTP user-agent string. It returns "WebTV/2.2" instead of "WebTV/1.2". Back up