Please read Browser detection using the user agent for why serving different Web pages or services to different browsers is usually a bad idea.
|Header type||Request header|
|Forbidden header name||no|
User-Agent: <product> / <product-version> <comment>
Common format for web browsers:
User-Agent: Mozilla/5.0 (<system-information>) <platform> (<platform-details>) <extensions>
- A product identifier — its name or development codename.
- Version number of the product.
- Zero or more comments containing more details; sub-product information, for example.
For more on Firefox- and Gecko-based user agent strings, see the Firefox user agent string reference. The UA string of Firefox is broken down into 4 components:
Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion
Mozilla/5.0is the general token that says the browser is Mozilla-compatible. For historical reasons, almost every browser today sends it.
- platform describes the native platform the browser is running on (Windows, Mac, Linux, Android, etc.), and if it's a mobile phone. Firefox OS phones say
Mobile— the web is the platform. Note that platform can consist of multiple "
;"-separated tokens. See below for further details and examples.
- rv:geckoversion indicates the release version of Gecko (such as "17.0"). In recent browsers, geckoversion is the same as firefoxversion.
- Gecko/geckotrail indicates that the browser is based on Gecko. (On Desktop, geckotrail is always the fixed string
- Firefox/firefoxversion indicates the browser is Firefox, and provides the version (such as "17.0").
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0
The Chrome (or Chromium/Blink-based engines) user agent string is similar to Firefox’s. For compatibility, it adds strings like
KHTML, like Gecko and
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
The Opera browser is also based on the Blink engine, which is why it almost looks the same, but adds
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36 OPR/38.0.2220.41
Older, Presto-based Opera releases used:
Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.15 Version/10.00 Opera/9.60 (Windows NT 6.0; U; en) Presto/2.1.1
In this example, the user agent string is mobile Safari’s version. It contains the word
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
Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Mozilla/5.0 (compatible; YandexAccessibilityBot/3.0; +http://yandex.com/bots)
|RFC 7231, section 5.5.3: User-Agent||Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content|
|RFC 2616, section 14.43: User-Agent||Hypertext Transfer Protocol -- HTTP/1.1|
BCD tables only load in the browser