Gecko user agent string reference

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). See also our document on user agent sniffing and this Hacks 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, 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.
  • Firefox/firefoxversion indicates the browser is Firefox, and provides the version (such as "17.0").
  • 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"
  • from Firefox 10 on mobile, geckotrail is the same as firefoxversion
Note: 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.

(Firefox 11.0 / Thunderbird 11.0 / SeaMonkey 2.8)

Mobile and Tablet indicators

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 to 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 Mobi (to include Opera Mobile, which uses "Mobi") for the phone 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. Also, please use touch detection to find touch devices rather than looking for "Mobi" or "Tablet" - there may be touch devices which are not tablets.

Note: Firefox OS devices identify themselves without any operating system indication; for example: "Mozilla/5.0 (Mobile; rv:15.0) Gecko/15.0 Firefox/15.0". The web is the platform.

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:26.0) Gecko/26.0 Firefox/26.0
Tablet Mozilla/5.0 (Android; Tablet; rv:26.0) Gecko/26.0 Firefox/26.0

Firefox OS

Form factor Gecko user agent string
Phone Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0
Tablet Mozilla/5.0 (Tablet; rv:26.0) Gecko/26.0 Firefox/26.0
Device-specifc Mozilla/5.0 (Mobile; nnnn; rv:26.0) Gecko/26.0 Firefox/26.0

Device-specific user agent strings

Although it is discouraged by Mozilla, some handset manufacturers include a token in their device's UA string that represents their device id. If this is the case, the Firefox OS UA string will look like the device-specific string in the table above, where nnnn; is the manufacturer's code for the device. This code could be something like NexusOne; or ZTEOpen;We provide this information to assist with your UA detection logic, but Mozilla discourages the detection of a device id in UA strings.

Here is a JavaScript regular expression that will detect all mobile devices, including devices with a device id in their UA string:

/mobi/i

The i makes it case-insensitive, and mobi matches all mobile browsers.

Firefox OS version number

While the version number for Firefox OS is not included in the UA string, it is possible to infer version information from the Gecko version number present in the UA string. Beginning with Firefox OS 1.2, each minor version should correspond to two major Gecko revisions.

Firefox OS version number Gecko version number
1.0.1 18.0
1.1 18.1
1.2 26.0
1.3 28.0

Firefox OS has a 4 digit version number: X.X.X.Y. The first 2 digits are owned by the Mozilla product team and will denote versions with new features (eg: v1.1, 1.2, etc). The third digit will be incremented with regular version tags (~every 6 weeks) for security updates, and the fourth will be OEM owned.

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). But that has not been possible since bug 581008.

In the past, specific plug-ins, add-ons or extensions added user agent parts to notify sites they were installed. The recommended way to do this, if it's absolutely necessary (remember that it slows down every request) is to set a custom HTTP header.

See Also


Comments to mozilla.dev.platform

Document Tags and Contributors

Last updated by: OllyHodgson,