User-Agent Header

Table of Content

The User-Agent header is a HTTP header field that contains a characteristic string that allows network protocol peers to identify the application type, operating system, software vendor or software version of the requesting party. Essentially, whenever a browser makes a HTTP request, it includes this header to provide information about itself to the server, enabling the latter to offer a user interface tailored to its specific capabilities and restrictions.

Syntax

User-Agent: <product> / <product-version> <comment>

Directives

The User-Agent header has two primary directives: product and product-version. The product directive refers to the name of the software making the request, while product-version corresponds to the version of that specific software.

Examples

// A Chrome browser on windows desktop
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537

// An iPhone on iOS 13.5.1 using Safari
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1

Browser Compatibility

Browser Compatibility
Chrome Supported
Firefox Supported
Safari Supported
Opera Supported
Edge Supported

How to modify User-Agent header

ModHeader is a Chrome extension that allows you to modify request headers, such as User-Agent. This must be done in the following steps:

  1. Install the ModHeader extension from the Chrome Web Store.
  2. Click the ModHeader icon in the toolbar to open the extension.
  3. You will find an input field labeled 'Request header'. Type 'User-Agent' in this field.
  4. In the adjacent input field, enter the User-Agent value you wish to use.
  5. Refresh your browser. All future requests will now use this User-Agent value.

Modifying the User-Agent header is beneficial for testing how servers respond to different browser versions, assisting in identifying potential compatibility issues. It's also used for mobile testing to check how a site responds to different mobile browsers.