Revision 1095815 of User-Agent

  • Revision slug: Web/HTTP/Headers/User-Agent
  • Revision title: User-Agent
  • Revision id: 1095815
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment new page

Revision Content

{{HTTPSidebar}}

The User-Agent request header contains a characteristic string that allows the network protocol to identify the application type, operating system, software vendor or software version of the requesting software user agent.

Header type {{Glossary("Request header")}}
{{Glossary("Forbidden header name")}} no

Syntax

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

Common format for web browsers:
User-Agent: Mozilla/<version> (<system-information>) <platform> (<platform-details>) <extensions>

Directives

<product>
A product identifier
<product-version>
A version number of the product.
<comment>
Zero or more comments containing sub product information, for example.

Firefox UA string

The UA string of Firefox itself is broken down into four components:

Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion

  • Mozilla/5.0 is the general token that says the browser is Mozilla compatible, and is common to almost every browser today.
  • platform describes the native platform the browser is running on (e.g. Windows, Mac, Linux or Android), and whether or not it's a mobile phone. Firefox OS phones simply 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 the fixed string "20100101"
  • Firefox/firefoxversion indicates the browser is Firefox, and provides the version (such as "17.0").

Examples

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

Chrome UA string

TBD

Examples

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36

Opera UA string

TBD

Examples

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

Safari UA string

TBD

Examples

Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

Specifications

Specification Title
{{RFC("7231", "User-Agent", "5.5.3")}} Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content

Browser compatibility

{{Compat}}

See also

Revision Source

<div>{{HTTPSidebar}}</div>

<p>The <strong>User-Agent</strong> request header contains a characteristic string that allows the network protocol to identify the application type, operating system, software vendor or software version of the requesting software user agent.</p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">Header type</th>
   <td>{{Glossary("Request header")}}</td>
  </tr>
  <tr>
   <th scope="row">{{Glossary("Forbidden header name")}}</th>
   <td>no</td>
  </tr>
 </tbody>
</table>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">
User-Agent: &lt;product&gt; / &lt;product-version&gt; &lt;comment&gt;

Common format for web browsers:
User-Agent: Mozilla/&lt;version&gt; (&lt;system-information&gt;) &lt;platform&gt; (&lt;platform-details&gt;) &lt;extensions&gt;
</pre>

<h2 id="Directives">Directives</h2>

<dl>
 <dt>&lt;product&gt;</dt>
 <dd>A product identifier</dd>
 <dt>&lt;product-version&gt;</dt>
 <dd>A version number of the product.</dd>
 <dt>&lt;comment&gt;</dt>
 <dd>Zero or more comments containing sub product information, for example.</dd>
</dl>

<h2 id="General_form">Firefox UA string</h2>

<p>The UA&nbsp;string of Firefox itself is broken down into four components:</p>

<p><strong>Mozilla/5.0 (<em>platform</em>; rv:<em>geckoversion</em>) Gecko/<em>geckotrail</em> Firefox/<em>firefoxversion</em></strong></p>

<ul>
 <li><em><strong>Mozilla/5.0</strong></em> is the general token that says the browser is Mozilla compatible, and is common to almost every browser today.</li>
 <li><strong><em>platform</em></strong> describes the native platform the browser is running on (e.g. Windows, Mac, Linux or Android), and whether or not it's a mobile phone. Firefox OS phones simply say "Mobile"; the web is the platform. Note that <strong><em>platform</em></strong> can consist of multiple "; "-separated tokens. See below for further details and examples.</li>
 <li><strong>rv:<em>geckoversion</em></strong> indicates the release version of Gecko (such as <em>"17.0"</em>). In recent browsers, <strong><em>geckoversion</em></strong> is the same as <strong><em>firefoxversion</em></strong>.</li>
 <li><strong><em>Gecko/geckotrail</em></strong> indicates that the browser is based on Gecko.</li>
 <li>On Desktop, <em><strong>geckotrail</strong></em> is the fixed string "20100101"</li>
 <li><em><strong>Firefox/firefoxversion</strong></em> indicates the browser is Firefox, and provides the version (such as "<em>17.0"</em>).</li>
</ul>

<h3>Examples</h3>

<pre>
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0
Mozilla/5.0 (Macintosh; Intel Mac OS&nbsp;X&nbsp;<em>x.y</em>; rv:42.0) Gecko/20100101 Firefox/42.0
</pre>

<h2>Chrome UA string</h2>

<p>TBD</p>

<h3>Examples</h3>

<pre>
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36</pre>

<h2>Opera UA string</h2>

<p>TBD</p>

<h3>Examples</h3>

<pre>
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</pre>

<h2>Safari UA string</h2>

<p>TBD</p>

<h3>Examples</h3>

<pre>
Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Title</th>
  </tr>
  <tr>
   <td>{{RFC("7231", "User-Agent", "5.5.3")}}</td>
   <td>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p class="hidden">The compatibility table in this page is generated from structured data. If you’d like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data/README.md">https://github.com/mdn/browser-compat-data/README.md</a> and send us a pull request.</p>

<p>{{Compat}}</p>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="https://hacks.mozilla.org/2013/09/user-agent-detection-history-and-checklist/">User-Agent detection, history and checklist</a></li>
</ul>
Revert to this revision