What is a User Agent?


A user-agent is defined as the client application, or computer system, that is used with a particular network protocol, such as the World Wide Web. In broken down terms, the user-agent is the computer system's application that is remotely accessing another computer, or server, via the network. In most cases your web browser is the user-agent and the network is the Internet. In fact, this sort of system to system communication is referred to as client-server, and it is used by the Internet: it means that a user (such as your web browser) accesses a program or service that is operating on another, remote, system (a web page) via the internet protocol of that system (the web page's server).

To break it down more simply, let's describe how the process works. When web users visit a web site a text string (a computer programming sequence of symbols) is sent to the server of that web site in order to identify the user agent. It is a request of sorts: the web browser is requesting access to the website. Part of this request, then, is that the web browser be identified as the user-agent. This identification of the user agent contains specific information, including the application name and version, the host operating system and language. An example of this is as follows:

Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101

In the earlier Internet days, the web became dominated by one web browser or another. As a result, most websites were designed to perform with only that particular web browser which was dominant at the time. This was possible because the website could identify that web browser as the user-agent when it sent its text string and requested to use the site. The website would sniff out the browser via the user-agent text string and only send it incomplete information, or perhaps refuse it any information at all. Whereas if the website detected the correct web browser, that user-agent would receive all information provided by the website.

To overcome this, web browsers were designed or modified to replicate the text string that would be accepted by the website. This is a practice known as user-agent spoofing. The earliest, if not best, example of this is when Internet Explorer spoofed its primary rival, Netscape Navigator, as a user-agent in order to gain access to websites intended for only Netscape. To do so, Internet Explorer would send a user-agent string like the one shown here:

Mozilla/<version> (compatible; MSIE <version>...

* note that Mozilla here is the original codename for Netscape, and is not intended to represent the web browser Mozilla Foxfire

When Internet Explorer later came to dominate the market, other web browsers began to copy its user-agent string. Thus, the format listed above is quiet popular, if not almost universal, among user-agent strings.

To curb this habit for copying, or spoofing, web developers are beginning to reemphasize the need to return to standards-based web development: those based on the World Wide Web Consortium (W3C). To enforce such standards, they are designing web pages to be viewable to any browser. Although today there are more websites that accept all browsers than in any other point in history, it will still be some time before the practice of user-agent spoofing is completely curtailed.