Every time your browser asks a website for a page, it introduces itself. The introduction is one line of text called the user agent, and it says roughly what browser you are using and on what kind of device. Sites use that line to decide what to send back. This article explains how to read a user agent, why it looks so strange, what sites do with it, and what happens when you change it.
What a user agent is
A request for a web page comes with a few lines of information called headers. One of them is named User-Agent. Your browser fills it in on its own, on every request, to every site. Scripts running on a page can read the same text.
The idea is as old as the web: tell the server what kind of program is asking, so it can answer in a way that program understands. In practice the line answers three questions. Which browser is this? Which version? What is it running on?
How to read one
Here is the kind of line a desktop browser sends:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:128.0) Gecko/20100101 Firefox/128.0
It looks like nonsense until you take it apart.
| Part | What it means |
|---|---|
Mozilla/5.0 | A historical token. Nearly every browser sends it, so it tells a site nothing. |
(Macintosh; Intel Mac OS X 10.15; rv:128.0) | The platform: a Mac. The system version shown here is frozen at an old number on purpose, and does not reveal the real one. |
Gecko/20100101 | Another compatibility token. The date in it has not changed in years. |
Firefox/128.0 | The useful part: the browser's name and version. |
The clutter has a history. In the 1990s, sites began sending their best pages only to browsers whose user agent contained a certain word. Other browsers responded by adding that word to their own. Then it happened again with the next word. Decades later, most user agents carry a pile of tokens that exist only so that old checks keep passing. A phone's user agent adds the word Mobile and often the device model.
Why websites look at it
- To choose a layout. Some sites send a different page to phones than to computers.
- To offer the right download. A download page shows the Mac version to Mac users.
- To work around bugs. A site may avoid a feature in a browser version known to handle it badly.
- To count. Statistics about which browsers visit a site come from this line.
- To sort people from programs. Search engine crawlers and command-line tools announce themselves here, and sites treat them differently.
Reading the user agent to make decisions is called sniffing, and it has a poor reputation among web developers. The text is easy to get wrong, it changes with every release, and any visitor can send whatever they like. The better practice is to test whether a feature works, not to guess from the browser's name. Plenty of sites sniff anyway.
A user agent is also a tracking signal
A detailed user agent narrows down who you might be. On its own it is shared with many other people, but combined with your screen size, time zone, fonts and other details, it helps make a browser fingerprint.
Browser makers have responded by saying less. Many now freeze parts of the line, such as the exact operating system version, which is why the Mac in the example claims a system from years ago. Some browsers have also added a newer mechanism called client hints: the browser sends a short, low-detail description by default, and a site that needs more, such as the exact device model, has to ask for it. Not every browser sends client hints, so sites cannot rely on them alone.
What changes when you change it
You can tell your browser to send a different user agent. There are good reasons to:
- Testing your own site. See which layout it sends to a phone or to another browser without picking up another device.
- Getting past a wrong guess. A site that says "your browser is not supported" based on the name alone will often work fine once the name changes.
- Asking for the other version. Request the desktop page on a tablet, or the mobile page on a computer.
There are also ways it goes wrong. The site believes the new line and may send code written for that other browser, so menus, video or sign-in can break. And the rest of your browser still tells the truth. A user agent that says "phone" from a browser with a 27-inch window and a mouse is an unusual combination, and unusual is the opposite of blending in. Changing the user agent is a testing and compatibility tool. It does not hide you.
How Vela handles user agents
By default Vela sends a mainstream Safari user agent, so sites answer with their standard pages. You can change that in two places.
- For the whole browser. On the Mac, open Settings → Network and use Identify as under User Agent. The list is grouped into phones, tablets and desktop browsers, with more than ninety choices, and the change applies to open tabs straight away. On iPhone and iPad the same list is in the menu, under Privacy & Network → User Agent.
- For one profile. Each profile can have its own user agent, set in the profile editor. A profile's own user agent overrides the global one, so a testing profile can look like a phone while your everyday profile stays on the default.
When you pick a phone or a tablet, Vela also asks sites for the mobile version of the page, so the layout you get matches the identity you chose. If fingerprint protection is on, the other details it reports, such as the platform, follow the chosen user agent and stay consistent with it. If you use Real Browser mode, leave the user agent on Default.
The steps for Mac, iPhone and iPad are in how to change the user agent in Vela.