User Agent String

user-agent-string

What Is a User Agent String?

A user agent is a piece of software that acts on behalf of a user – such as a web browser. A user agent string however is sent as an HTTP Request Header by the browser and identifies which operating system is being used, the browser version, and other information which is provided to the web server.

The naming conventions for user agent strings can sometimes be confusing as they often contain tokens that may not have an obvious meaning. However, these strings contain important information that will allow a particular website’s web server to deliver content that is most compatible with your web browser, browser version, etc.

User Agent Tokens

Within user agent strings there can exist many tokens. These tokens are what provide specific detail to the web server so that it can respond appropriately. The section below describes a few token categories and their purpose.

Version Tokens

Version tokens, as the name implies, display the version of a particular browser. The following list displays examples for 3 various popular web browsers.

Token Description
Chrome/41.0.2228.0  Chrome web browser running on version 41.0.2228.0
Firefox/40.1  Firefox web browser running on version 40.1
MSIE11  Internet Explorer web browser running on version 11

Platform Tokens

Platform token are used to help the web server identify which operating system is being used. The following are token examples of various platforms.

Token Description
Intel Mac OS X 10_11_2  Macintosh OS X version 10_11_2  running on Intel CPU
Linux x86_64  Linux running on Intel CPU and 64-bit processor
Windows NT 6.3  Windows 8.1

Other Tokens

There are many other tokens that exist that may also be included in the user agent string. Although the list is quite large, here are a few popular other tokens to mention.

Token Description
Tablet PC Tablet services are installed. This token is also accompanied by a version number
AppleWebKit  Provides a set of core classes to display web content in windows
Like Gecko  Mozilla-based rendering engine
KHTML  Konquerer-based rendering engine

User Agent String Example

User agent strings can come in many different forms depending on the combinations of software being used. The user agent string that your system sends to a web server as a request header can be seen within Chrome Developer Tools by navigating to the Network tabs, selecting an asset, and finding the User-Agent Request Header.

user-agent-request-header

In the above screenshot, the resulting user agent string is:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36

These components can be broken down into the following:

  • Mozilla: In modern browsers this is irrelevant and only used for historical reasons.
  • 5.0: Mozilla version
  • Macintosh: Platform
  • Intel Mac OS X 10_11_2: The operating system is OS X version 10_11_2  and running on Intel CPU
  • AppleWebKit/537.36: WebKit build 537.36 that helps display web content in windows
  • KHTML, like Gecko: HTML layout engine developed by the KDE project and similar to the Gecko engine
  • Chrome/47.0.2526.80: Chrome web browser, version 47.0.2526.80
  • Safari/537.36: Based on Safari build 537.36

As mentioned, there is an array of user agent string possibilities and a large list of these possibilities can be found at useragentapi.com. User agent strings can also be analyzed simply by copy/pasting the string into the User Agent String Analyzer which will provide a description for each part of the string.

Conclusion

The user agent string is an important aspect of the web as it identifies many various software components and delivers them to the web server for optimal HTTP responses. Without this identification, web servers would not be aware of compatibility issues that may occur with certain types of software and what should be done to avoid them.

When analyzing the KeyCDN logs, there is also the ability to display the user agent string which may be beneficial for debugging purposes.

Leave A Comment?