What's a User Agent?

The term "user agent" might sound like a character from Get Smart, though user agents never played opposite Agent 86.  The term was coined in the early days of the Internet when users needed tool to help navigate the Internet.  Back then, the Internet was (an actually still is) completely text-based, and to navigate the text, text commands needed to be typed into a keyboard.  Soon tools were developed to be the users 'agent', acting on the user's behalf so that the user didn't have to understand the cryptic commands in order to retrieve information.  Today, nearly everyone uses a web browser as their user agent. 

Sometimes it's necessary for a web site to understand how it is being viewed, so most user agents identify themselves by sending a User Agent String to the web site. (A string is a series of characters, usually letters and numbers.)  You can view your User Agent String here at WhatsMyUserAgent.com

Different web browsers (Chrome, Internet Explorer, Firefox, Opera, etc.) would therefore identify themselves with different user agent strings.  Search engines like Google, Yahoo!, and MSN send out web crawlers to view web pages to be listed in their search engines, and those web crawlers identify themselves with different user agent strings.  This is how web site visitor reports can differentiate human visitors from robotic ('bot') visitors.

The user agent typically consists of 6 different components:

User agents consist of: application name, application version, compatibility flag, browser name and version, operating system and any extensions installed

As you can see from the above diagram, the user agent string given is an example user agent generated by the browser Internet Explorer version 7 (the most recent IE to have been released). Other browsers (e.g. Firefox, Opera, Netspace) will give slightly different user agent strings, although the format is relatively similar to what is shown above. To view more example user agents, check out our Common User Agents page.

What's the Point in User Agents, then?

So now that you know a little bit about what user agents are, and what they tend to look like, you may be thinking: 'So, what's the point in user agents?'. As we've established - user agent strings identify what a user is using to access a web-page. And this is the basis for their primary use. Dynamic websites may deliver (slightly) different content depending upon what browser is being used. For example, if you use Firefox and go to download Firefox via a Google Adsense referral advert, the resulting page will say words to the effect of "You have already downloaded Firefox; why not download the Google Toolbar instead?". Another example is when websites check what browser you are using, and may give a different CSS stylesheet depending upon what browser you are using (this is because Internet Explorer interprets some CSS styles completely differently to other browsers, hence a CSS stylesheet specifically for IE is sometimes needed).

These two examples are both based upon analysing the user agent. The diagram below will hopefully help to illustrate this:

A website detects the user is using IE 7, and so shows an IE-specific CSS stylesheet