Sometimes abbreviated as UA, the user agent is a browser text string that is given to
each website you visit. The user agent text string contains
information such as the browser version, compatibility, operating
system and version and any plugins that modify the user agent. Using
this information a website can know what the capabilities of your
computer are to help display the page properly.
Below are some
examples of user agents and some additional information about each
of these text strings.
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322)
Mozilla/4.0 is still used for historical reasons as stated
by Microsoft and is not to be confused with the variants of Mozilla
browsers such as Firefox. Next, is the actual Microsoft Internet
Explorer version: "compatible; MSIE 6.0;" which indicates
this user has Internet Explorer 6.0. Next, "Windows NT 5.1; SV1;"
is a description of the operating system in this case this user
agent is using Microsoft Windows XP with Service Pack 1. Finally,
the .NET CLR 1.1.4322 is the .NET framework. Often the user
agent strings with Internet explorer will have various .NET
versions.
Mozilla/5.0 (X11;
U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080325
Fedora/2.0.0.13-1.fc8 Firefox/2.0.0.13
In this second example this user agent is on a Linux variant. The
first thing noticeably different about this user agent is the
X11; which is variant of X Windows, next U; is the
encryption level, which is short for USA and an indication of strong
encryption. In the past different browser encryption versions had to
be released for different parts of the world because of laws in the
United States. Other encryption types were I; and
N; although today all browsers in all parts of the world use U;.
Next, i686; and Fedora/2.0.0.13-1.fc8 is the platform
and type of OS. Next, en-US; is the language and location of
the browser, in this case English and US. Finally,
Firefox/2.0.0.13 is the browser type and version.
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5;
en-US; rv:1.9b4) Gecko/2008030317 Firefox/3.0b4
In this last example this user agent is a Apple Macintosh
computer. As can be seen it has a lot of similarities as the above
example, which is also running Firefox. However, this user agent
does list Macintosh as the type of computer and Intel Mac OS
X 10.5; which is the processor type and operating system. Apple
computers that are not running an Intel processor will be displayed
as PPC.
Different Windows versions in the user agent
Below is additional information about each of the different versions
of Microsoft Windows and their corresponding user agent string
codes.
Windows 95 = Windows 95 or Win95
Windows 98 & 98 SE = Windows 98 or Win98
Windows CE = Windows CE
Windows ME = Windows 9x 4.90
Windows NT 4.0 = Windows NT 4.0
Windows 2000 = Windows NT 5.0
Windows XP = Windows NT 5.1
Windows Server 2003 / XP x64 edition = Windows NT 5.2
Windows Vista = Windows NT 6.0
How to get this
information
There are various ways to get this information
to be displayed or gathered if you're a developer of a website. As
shown in the example at the beginning of the page using
JavaScript is an easy way to display
the user agent to the visitor. However, if you're wanting to gather
the information or manipulate it may be better to use a server side
scripting language such as Perl
to gather the information. Below is an example of how to display the
user agent in Perl.
See our
System Information script for an example of a script taking
full advantage of the user agent information and other
information obtainable through
JavaScript.