Each time you type a website in the address bar, your browser sends a message to the web server which responds with the content of the web page. One of the more important pieces of information that is relayed to the web server is the user agent.
What Are User Agents?
User agents are short strings of text sent by Internet browsers that describe the browser or application (also known as the Agent) requesting a file from the web server.
The user agent often includes a description of the device and operating system that the web browser is running on.
Why They Are Important
Each time key in an address in your browser, the browser requests for this file from the web server. The user agent data is part of the HTTP header forming this request and this initiates the process of content negotiation. Web servers have different file versions of the same URL. They examine the user agent to determine what device, operating system, browser and plugins you are using to know which file to send.
What is Their Intended Use?
When the web server receives the user agent data, it determines the user agent’s capabilities. With that, it can send the right data to it. Web browser types and versions do not have the same capabilities. So sending the wrong data to the browser may see the web page not rendered correctly on the end user’s device.
What Are the Different Types?
The major types of user agents include:
How Do You Read The HTTP User Agent Strings?
The content and structure of the user agent string is not standardized. Each developer defines the data they deem fit. Broadly speaking though, the format is <product>, <product version>, <comment with additional information such as sub-product data>.
For instance, the user agent structure of a Firefox browser running on a Windows operating system would be in the following format.
Firefox user agent
(Windows NT 6.1; Win64; x64; rv:64.0)
Breaking down the structure of the example, Mozilla/5.0 implies the browser is Mozilla compatible. This is a fixed, legacy token that is used by nearly all browsers.
Windows NT 6.1; Win64; x64 is the operating system platform and version the browser runs on. rv:64 refers to the Gecko version in use. Gecko is Firefox’s HTML rendering engine that facilitates display of web pages. Gecko/20100101 shows the browser is built on Gecko while 20100101 is a fixed string for desktop Firefox browsers. Firefox/64.0 is the version of Mozilla Firefox.
Most major browsers allow you to customize user agents in order to get a certain version of a web page. For instance, you can change the user agent to render mobile versions of a web page on your desktop computer