Gecko user agent string reference

  • Revision slug: Gecko_user_agent_string_reference
  • Revision title: Gecko user agent string reference
  • Revision id: 8215
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 33 words added

Revision Content

{{ gecko_minversion_header("2.0") }}

This document describes the user agent string used in Firefox 4 and later and applications based on Gecko 2.0 and later. For a breakdown of changes to the string in Gecko 2.0, see Final User Agent string for Firefox 4 (blog post).

General form

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, or Linux). 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 "10.0"). From Firefox 5.0 and Gecko 5.0 onwards, geckoversion is the same as firefoxversion (described below).
  • Gecko/geckotrail indicates that the browser is based on Gecko. geckotrail is "20100101" in desktop release builds and does not represent the actual build date of the browser. For desktop development builds, geckotrail presently indicates the build date of the browser, but this is likely to change in the future. Starting February 1st 2012, geckotrail is the same as geckoversion and firefoxversion in Firefox for Android with a native front end (aka. Fennec Native).
  • Firefox/firefoxversion indicates the browser is Firefox, and provides the version (such as "11.0").

Note: The Gecko/20100101 token may be replaced by "Gecko/geckoversion" in future desktop releases as well. Do not rely on the presence of the "yyyymmdd" string! The recommended way of sniffing for Gecko-based browsers (if you have to sniff for the browser engine instead of using feature detection) is by the presence of the "Gecko" and "rv:" strings, since some other browsers include a "like Gecko" token.

For other products based on Gecko, the string can take one of two forms, where the tokens have the same meaning except those noted below:

Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail appname/appversion
M
ozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion appname/appversion

  • appname/appversion indicates the application name and version. For instance, this could be "Camino/2.1.1", or "SeaMonkey/2.7.1".
  • Firefox/firefoxversion is an optional compatibility token that some Gecko-based browsers may choose to incorporate, to achieve maximum compatibility with websites that expect Firefox.  firefoxversion will generally represent the equivalent Firefox release corresponding to the given Gecko version. Some Gecko-based browsers may not opt into using this token; for this reason, sniffers should be looking for Gecko — not Firefox! Whether this token appears is controlled by the "general.useragent.compatMode.firefox" boolean pref.

{{ h1_gecko_minversion("Mobile and Tablet indicators", "11.0") }}

The platform part of the UA string indicates if Firefox is running on a phone-sized or tablet device. When Firefox runs on a device that has the phone form factor, there is a Mobile; token in the platform part of the UA string. When Firefox runs on a tablet device, there is a Tablet; token in the platform part of the UA string instead. For example:

Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0

Mozilla/5.0 (Android; Tablet; rv:13.0) Gecko/13.0 Firefox/13.0

The preferred way to target content a device form factor is to use CSS Media Queries. However, if you use UA sniffing to target content to a device form factor, please look for Mobile for the phone form factor and Tablet for the tablet form factor and do not assume any correlation between "Android" and the device form factor. This way, your code will work if/when Firefox ships on other phone/tablet operating systems or Android is used for laptops.

Note: Boot to Gecko phones identify themselves just like Fennec Android; for example: "Mozilla/5.0 (Android; Mobile; rv:15.0) Gecko/15.0 Firefox/15.0a1".

Historical note: Before the Mobile / Tablet token was introduced, both phone and tablet form factors had a Fennec/firefoxversion token at the end of the UA string instead.

Windows

Windows user agents have the following variations, where x.y is the Windows NT version (for instance, Windows NT 6.1).

Windows version Gecko user agent string
Windows NT on x86 Mozilla/5.0 (Windows NT x.y; rv:10.0) Gecko/20100101 Firefox/10.0
Windows NT, Win64 on x64 Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0
Windows NT, WOW64 Mozilla/5.0 (Windows NT x.y; WOW64; rv:10.0) Gecko/20100101 Firefox/10.0

Macintosh

Here, x.y is the version of Mac OS X (for instance, Mac OS X 10.6).

Mac OS X version Gecko user agent string
Mac OS X on Intel x86 or x86_64 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0
Mac OS X on PowerPC Mozilla/5.0 (Macintosh; PPC Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0

Linux

Linux is a more diverse platform. A few common examples are given below.

Linux version Gecko user agent string
Linux desktop, i686 Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0
Linux desktop, x86_64 Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0
Linux desktop, i686 running on x86_64 Mozilla/5.0 (X11; Linux i686 on x86_64; rv:10.0) Gecko/20100101 Firefox/10.0
Nokia N900 Linux mobile, on the Fennec browser Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0) Gecko/20100101 Firefox/10.0 Fennec/10.0

Android

Form factor Gecko user agent string
Phone Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0
Tablet Mozilla/5.0 (Android; Tablet; rv:13.0) Gecko/13.0 Firefox/13.0
Phone; legacy Firefox {{ obsolete_inline() }} Mozilla/5.0 (Android; Mobile; rv:10.0.5) Gecko/10.0.5 Firefox/10.0.5 Fennec/10.0.5
Tablet; legacy Firefox {{ obsolete_inline() }} Mozilla/5.0 (Android; Tablet; rv:10.0.5) Gecko/10.0.5 Firefox/10.0.5 Fennec/10.0.5
Note: "Legacy Firefox" is no longer available for download, but may still be installed by users who have not updated.

Other Gecko-based browsers

These are some sample UA strings from other Gecko-based browsers on various platforms. Note that many of these have not yet been released on Gecko 2.0!

Browser Gecko user agent string
Firefox for Maemo (Nokia N900) Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1
Camino on Mac Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Camino/2.2.1
SeaMonkey on Windows Mozilla/5.0 (Windows NT 5.2; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1
SeaMonkey on Mac Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1
SeaMonkey on Linux Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1

Implementation notes for applications, vendors, and extensions

Prior to Firefox 4 and Gecko 2.0, it was possible for extensions to add user agent parts through the general.useragent.extra.identifier preferences, (see the obsolete User Agent Strings Reference). It's not possible anymore since {{ Bug("581008") }}.

Adding user agent parts was often used to have a web site be able to check if a specific plug-in, add-on, or extension was installed. Now the recommended way to do this is to set a custom HTTP header.

See Also


Comments to mozilla.dev.platform

{{ languages( { "ja": "ja/Gecko_user_agent_string_reference"} ) }}

Revision Source

<p>{{ gecko_minversion_header("2.0") }}</p>
<p>This document describes the user agent string used in Firefox 4 and later and applications based on Gecko 2.0 and later. For a breakdown of changes to the string in Gecko 2.0, see <a class="external" href="http://hacks.mozilla.org/2010/09/final-user-agent-string-for-firefox-4/" title="Final User Agent string for Firefox 4">Final User Agent string for Firefox 4</a> (blog post).</p>
<h2 id="General_form"><span id="proposal">General form</span></h2>
<p>The UA string of Firefox itself is broken down into four components:</p>
<p style="margin-left: 40px;"><span style="font-size: medium;"><strong>Mozilla/5.0 (<em>platform</em>; rv:<em>geckoversion</em>) Gecko/<span style="font-style: italic;">geckotrail</span> Firefox/<em>firefoxversion</em></strong></span></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, or Linux). 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>"10.0"</em>). From Firefox 5.0 and Gecko 5.0 onwards, <strong><em>geckoversion</em></strong> is the same as <strong><em>firefoxversion</em></strong> (described below).</li> <li><strong><em>Gecko/geckotrail</em></strong> indicates that the browser is based on Gecko. <span style="font-style: italic;"><span style="font-weight: bold;">geckotrail</span></span> is "<em>20100101</em>" in desktop release builds and does <strong>not</strong> represent the actual build date of the browser. For desktop development builds, <em><strong>geckotrail</strong></em> presently indicates the build date of the browser, but this is likely to change in the future. Starting February 1st 2012, <strong><em>geckotrail</em></strong> is the same as <em><strong>geckoversion</strong></em> and <em><strong>firefoxversion</strong></em> in Firefox for Android with a native front end (aka. Fennec Native).</li> <li> <p><em><strong>Firefox/firefoxversion</strong></em> indicates the browser is Firefox, and provides the version (such as "<em>11.0"</em>).</p> </li>
</ul>
<div class="note"><strong>Note:</strong> The <strong><em>Gecko/20100101</em></strong> token may be replaced by "<em>Gecko/geckoversion</em>" in future desktop releases as well. Do <strong>not</strong> rely on the presence of the "<em>yyyymmdd</em>" string! The recommended way of sniffing for Gecko-based browsers (if you <em>have to</em> sniff for the browser engine instead of using feature detection) is by the presence of the "<em>Gecko</em>" and "<em>rv:</em>" strings, since some other browsers include a "<em>like Gecko</em>" token.</div>
<p>For other products based on Gecko, the string can take one of two forms, where the tokens have the same meaning except those noted below:</p>
<p style="margin-left: 40px;"><span style="font-size: medium;"><strong>Mozilla/5.0 (<em>platform</em>; rv:<em>geckoversion</em>) Gecko/<em>geckotrail </em></strong></span><span style="font-size: medium;"><strong><em>appname</em>/<em>appversion<br> </em></strong><strong>M</strong></span><span style="font-size: medium;"><strong>ozilla/5.0 (<em>platform</em>; rv:<em>geckoversion</em>) Gecko/<em>geckotrail</em></strong></span><span style="font-size: medium;"><strong> Firefox/<em>firefoxversion</em></strong></span><span style="font-size: medium;"><strong> <em>appname</em>/<em>appversion</em></strong></span></p>
<ul> <li><strong><em>appname/appversion</em></strong> indicates the application name and version. For instance, this could be "<em>Camino/2.1.1</em>", or "<em>SeaMonkey/2.7.1</em>".</li> <li> <p><em><strong>Firefox/firefoxversion</strong></em> is an optional compatibility token that some Gecko-based browsers may choose to incorporate, to achieve maximum compatibility with websites that expect Firefox.  <em><strong>firefoxversion</strong></em> will generally represent the equivalent Firefox release corresponding to the given Gecko version. Some Gecko-based browsers may not opt into using this token; for this reason, sniffers should be looking for Gecko — not Firefox! Whether this token appears is controlled by the <em>"general.useragent.compatMode.firefox"</em> boolean pref.</p> </li>
</ul>
<p>{{ h1_gecko_minversion("Mobile and Tablet indicators", "11.0") }}</p>
<p>The <strong><em>platform</em></strong> part of the UA string indicates if Firefox is running on a phone-sized or tablet device. When Firefox runs on a device that has the phone form factor, there is a <strong>Mobile;</strong> token in the <strong><em>platform</em></strong> part of the UA string. When Firefox runs on a tablet device, there is a <strong>Tablet;</strong> token in the platform part of the UA string instead. For example:</p>
<p style="margin-left: 40px;"><span style="font-size: medium;">Mozilla/5.0 (Android; <strong>Mobile</strong>; rv:13.0) Gecko/13.0 Firefox/13.0</span></p>
<p style="margin-left: 40px;"><span style="font-size: medium;">Mozilla/5.0 (Android; <strong>Tablet</strong>; rv:13.0) Gecko/13.0 Firefox/13.0</span></p>
<p>The preferred way to target content a device form factor is to use CSS Media Queries. However, if you use UA sniffing to target content to a device form factor, please look for <strong>Mobile</strong> for the phone form factor and <strong>Tablet</strong> for the tablet form factor and do <strong>not</strong> assume any correlation between "Android" and the device form factor. This way, your code will work if/when Firefox ships on other phone/tablet operating systems or Android is used for laptops.</p>
<div class="note"><strong>Note:</strong> Boot to Gecko phones identify themselves just like Fennec Android; for example: "Mozilla/5.0 (Android; Mobile; rv:15.0) Gecko/15.0 Firefox/15.0a1".</div>
<p>Historical note: Before the <strong>Mobile</strong> / <strong>Tablet</strong> token was introduced, both phone and tablet form factors had a <strong>Fennec/<em>firefoxversion</em></strong> token at the end of the UA string instead.</p>
<h2 id="Windows">Windows</h2>
<p>Windows user agents have the following variations, where <em>x.y</em> is the Windows NT version (for instance, Windows NT 6.1).</p>
<table class="standard-table"> <thead> <tr> <th scope="col">Windows version</th> <th scope="col">Gecko user agent string</th> </tr> </thead> <tbody> <tr> <td>Windows NT on x86</td> <td>Mozilla/5.0 (Windows NT <em>x</em>.<em>y</em>; rv:10.0) Gecko/20100101 Firefox/10.0</td> </tr> <tr> <td>Windows NT, Win64 on x64</td> <td>Mozilla/5.0 (Windows NT <em>x</em>.<em>y</em>; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0</td> </tr> <tr> <td>Windows NT, WOW64</td> <td>Mozilla/5.0 (Windows NT <em>x</em>.<em>y</em>; WOW64; rv:10.0) Gecko/20100101 Firefox/10.0</td> </tr> </tbody>
</table>
<h2 id="Macintosh">Macintosh</h2>
<p>Here, <em>x.y</em> is the version of Mac OS X (for instance, Mac OS X 10.6).</p>
<table class="standard-table"> <thead> <tr> <th scope="col">Mac OS X version</th> <th scope="col">Gecko user agent string</th> </tr> </thead> <tbody> <tr> <td>Mac OS X on Intel x86 or x86_64</td> <td>Mozilla/5.0 (Macintosh; Intel Mac OS X <em>x.y</em>; rv:10.0) Gecko/20100101 Firefox/10.0</td> </tr> <tr> <td>Mac OS X on PowerPC</td> <td>Mozilla/5.0 (Macintosh; PPC Mac OS X <em>x.y</em>; rv:10.0) Gecko/20100101 Firefox/10.0</td> </tr> </tbody>
</table>
<h2 id="Linux">Linux</h2>
<p>Linux is a more diverse platform. A few common examples are given below.</p>
<table class="standard-table"> <thead> <tr> <th scope="col">Linux version</th> <th scope="col">Gecko user agent string</th> </tr> </thead> <tbody> <tr> <td>Linux desktop, i686</td> <td>Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0</td> </tr> <tr> <td>Linux desktop, x86_64</td> <td>Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0</td> </tr> <tr> <td>Linux desktop, i686 running on x86_64</td> <td>Mozilla/5.0 (X11; Linux i686 on x86_64; rv:10.0) Gecko/20100101 Firefox/10.0</td> </tr> <tr> <td>Nokia N900 Linux mobile, on the Fennec browser</td> <td>Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0) Gecko/20100101 Firefox/10.0 Fennec/10.0</td> </tr> </tbody>
</table>
<h2 id="Android">Android</h2>
<table class="standard-table"> <thead> <tr> <th scope="col">Form factor</th> <th scope="col">Gecko user agent string</th> </tr> </thead> <tbody> <tr> <td>Phone</td> <td>Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0<span class="Object" id="OBJ_PREFIX_DWT935_com_zimbra_ymaps"><span class="Object" id="OBJ_PREFIX_DWT936_com_zimbra_ymaps"> Firefox/13.0</span></span></td> </tr> <tr> <td>Tablet</td> <td>Mozilla/5.0 (Android; Tablet; rv:13.0) Gecko/13.0<span class="Object" id="OBJ_PREFIX_DWT935_com_zimbra_ymaps"><span class="Object" id="OBJ_PREFIX_DWT936_com_zimbra_ymaps"> Firefox/13.0</span></span></td> </tr> <tr> <td>Phone; legacy Firefox {{ obsolete_inline() }}</td> <td>Mozilla/5.0 (Android; Mobile; rv:10.0.5) Gecko/10.0.5 Firefox/10.0.5 Fennec/10.0.5</td> </tr> <tr> <td>Tablet; legacy Firefox {{ obsolete_inline() }}</td> <td>Mozilla/5.0 (Android; Tablet; rv:10.0.5) Gecko/10.0.5 Firefox/10.0.5 Fennec/10.0.5</td> </tr> </tbody>
</table>
<div class="note"><strong>Note: </strong>"Legacy Firefox" is no longer available for download, but may still be installed by users who have not updated.</div>
<h2 id="Other_Gecko-based_browsers">Other Gecko-based browsers</h2>
<p>These are some sample UA strings from other Gecko-based browsers on various platforms. Note that many of these have not yet been released on Gecko 2.0!</p>
<table class="standard-table"> <thead> <tr> <th scope="col">Browser</th> <th scope="col">Gecko user agent string</th> </tr> </thead> <tbody> <tr> <td>Firefox for Maemo (Nokia N900)</td> <td>Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1</td> </tr> <tr> <td>Camino on Mac</td> <td>Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Camino/2.2.1</td> </tr> <tr> <td>SeaMonkey on Windows</td> <td>Mozilla/5.0 (Windows NT 5.2; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1</td> </tr> <tr> <td>SeaMonkey on Mac</td> <td>Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1</td> </tr> <tr> <td>SeaMonkey on Linux</td> <td>Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1</td> </tr> </tbody>
</table>
<h2 id="Implementation_notes_for_applications,_vendors,_and_extensions"><span><span id="implementation">Implementation notes for applications, vendors, and extensions</span></span></h2>
<p>Prior to Firefox 4 and Gecko 2.0, it was possible for extensions to add user agent parts through the <code>general.useragent.extra.<em>identifier</em></code> preferences, (see the <a href="/En/User_Agent_Strings_Reference" title="https://developer.mozilla.org/en/User_Agent_Strings_Reference"><span class="moz-txt-link-freetext">obsolete User Agent Strings Reference</span></a><span class="moz-txt-citetags">).</span> It's not possible anymore since {{ Bug("581008") }}.</p>
<p>Adding user agent parts was often used to have a web site be able to check if a specific plug-in, add-on, or extension was installed. Now the recommended way to do this is to <a href="/en/Setting_HTTP_request_headers" title="https://developer.mozilla.org/en/Setting_HTTP_request_headers">set a custom HTTP header</a>.</p>
<h2 id="See_Also">See Also</h2>
<ul> <li><a class="external" href="http://hacks.mozilla.org/2010/09/final-user-agent-string-for-firefox-4/" title="Final User Agent string for Firefox 4">Final User Agent string for Firefox 4</a> (blog post)</li> <li>Recommendations on <a href="/en/Browser_Detection_and_Cross_Browser_Support" title="en/Browser_Detection_and_Cross_Browser_Support">sniffing the UA string for cross-browser support</a></li> <li><a href="../../../../en/DOM/window.navigator.userAgent" rel="internal">window.navigator.userAgent</a></li>
</ul>
<hr>
<p>Comments to <a class="link-news" href="news://news.mozilla.org/netscape.public.mozilla.netlib">mozilla.dev.platform</a></p>
<p>{{ languages( { "ja": "ja/Gecko_user_agent_string_reference"} ) }}</p>
Revert to this revision