HTTP - User Agent Header

About

An HTTP user-agent is a http header that sends the user agent string. It identifies the HTTP client (even when the client is not operated by a user).

Example

Browser

Generally, a user is using a a browser as HTTP client. In this case, the user-agent would have the value of the browser

Example with a Javascript script that shows you the user-agent of your browser.

console.log("The navigator user agent that you are using is: "+navigator.userAgent);

App

A client (user agent) may also be an app (most well known as a bot).

Example for Google Bot:

Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

Not real identifier

Browsers identify themselves with this string but the User Agent string may change legally in few cases.

Following examples are the same user agent

  • A smartphone whose screen rotated since the last request
Mozilla/5.0 (Linux; U; Android 2.2; en-us; DROID2 Build/VZW) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 854X480 motorola DROID2
Mozilla/5.0 (Linux; U; Android 2.2; en-us; DROID2 Build/VZW) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 480X854 motorola DROID2
  • Internet Explorer compatibility mode:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
  • A user accessing a web site through a proxy distributed across multiple servers, not all of which are upgraded to the latest version of the proxy software
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (FlipboardProxy/0.0.5; +http://flipboard.com/browserproxy)
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (FlipboardProxy/1.1; +http://flipboard.com/browserproxy)

Management

Modification

In Internet explorer with the devtool

  • F12
  • Then

Parser

Documentation / Reference


Powered by ComboStrap