User Agent Strings Reference

  • Revision slug: User_Agent_Strings_Reference
  • Revision title: User Agent Strings Reference
  • Revision id: 74464
  • Created:
  • Creator: user01
  • Is current revision? No
  • Comment Added valign="top" to first table column; one or more formatting changes

Revision Content

Status of this document

This is a major revision of the original, obsolete, user-agent string proposal. See the discussions on netscape.public.mozilla.seamonkey and netscape.public.mozilla.netlib for background information.

This document is the official Mozilla user-agent string specification. However, the following issues are under review and may be revised in the near future:

  • There is concern that the attempt to separate Platform and OS-or-CPU on Windows and Macintosh is not backwards compatible and the user-agent strings should return to their old-fashioned form.
  • There is concern that giving the operating system version on Windows reveals too much information about a system (such as potential security holes).
  • There is concern that this can be used to fingerprint users.
  • There is concern that revealing localization information is a violation of privacy.

Goals

The original goals:

  • Obey the standard described in RFC 1945 and RFC 2068.
  • Don't break existing web servers.
  • Don't break existing log-file analysis software or user-agent parsing code.
  • Keep the User-Agent string reasonably short.
  • Use a consistent, obvious, and easy-to-parse format.

Other concerns that came out of discussion:

  • Provide date-based version information.
  • Address the issue of version modifiers.
  • Provide a way for applications that contain Mozilla technology (i.e. Gecko) but are not Mozilla to identify themselves

Proposal

For browsers based on Mozilla, the user-agent string shall follow the format:

MozillaProductToken (MozillaComment) GeckoProductToken *(VendorProductToken|VendorComment)

Applications that embed the Gecko layout engine shall have user-agent strings that follow the format:

ApplicationProductToken (ApplicationComment) GeckoProductToken *(VendorProductToken|VendorComment)

Where:

MozillaProductToken Mozilla/ MozillaVersion
MozillaVersion Major . minor
Major Integer indicating major release number.  In practice, always 5.
Minor If non-zero, it shall be a three-digit, zero-filled number, i.e. 001. If zero, zero is fine.  In practice, always 0.
MozillaComment ( Platform ; Security ; OS-or-CPU;Localization information; GeckoVersion )*[; Optional Other Comments] )
Platform Allowed values:
  • Windows for all Microsoft Windows environments
  • Macintosh for all MacOS environments
  • X11 for X Window System environments
  • etc.
Security This was removed in mozilla2.0b2 as part of http-fingerprint.
Allowed values:
  • N for no security
  • U for strong security
  • I for weak security
OS-or-CPU Values for Windows systems:
  • Win3.11 for Windows 3.11
  • WinNT3.51 for Windows NT 3.11
  • WinNT4.0 for Windows NT 4.0
  • Windows NT 5.0 for Windows 2000
  • Windows NT 5.1 for Windows XP
  • Windows NT 5.2 for Windows Server 2003; Windows XP x64 Edition
  • Windows NT 6.0 for Windows Vista
  • Win95 for Windows 95
  • Win98 for Windows 98
  • Win 9x 4.90 for Windows Me
  • WindowsCE for Windows CE
  • etc.
Values for MacOS systems shall be:
  • 68K for 68k hardware
  • PPC for PowerPC hardware
  • etc.
Values for Unix systems shall be the output of the command uname -sm (also accessible as the sysname and machine fields of the utsname structure.) (Previous versions of this document said they should be the output of uname -srm, but the release field of the utsname structure was considered to reveal too much information about the system, such as potential security holes.)
Localization Information This was removed in mozilla2.0b2 as part of http-fingerprint.
Language Tag as described in the standards RFC 1945 and RFC 2068. Examples:
en, en-US, es, es-CO, ja, ja-JP, etc.
GeckoVersion String starting with "rv:" followed by the Gecko version.  This is a set of numbers separated by periods, possibly followed by a pre-release indicator (e.g. "a1" for the first alpha).
GeckoProductToken Gecko/GeckoDate

The Gecko product token allows products that embed the Gecko engine, including Mozilla, to identify this significant sub-product.

GeckoDate Date in the format YYYYMMDD. For official Mozilla builds, this will correspond to the date portion of the BuildID. For branded versions of Mozilla, the GeckoDate should correspond to the date the code was pulled from mozilla.org, and may not necessarily correspond to the date portion of the generated BuildID.  Note that the date does not identify the Gecko version if multiple branches are releasing in parallel.
ApplicationProductToken, Application Comment For use by applications that embed Gecko layout engine. The form of their product token and comment is not specified here, but should adhere to the HTTP standards.
( VendorProductToken | VendorComment ) Product tokens for applications based on Mozilla. Format and content shall be vendor-specific, but should adhere to the HTTP standards and ideally include a GeckoVersion as described above.
* Zero or more of the following token are allowed.
? Zero or one of the following token are allowed.

Examples

A mozilla.org release Mozilla/5.001 (windows; U; NT4.0; en-US; rv:1.0) Gecko/25250101
A branded release based on the same codebase as the browser above Mozilla/5.001 (Macintosh; N; PPC; ja; rv:1.0) Gecko/25250101 MegaCorpBrowser/1.0 (MegaCorp, Inc.)
A re-branded release Mozilla/9.876 (X11; U; Linux 2.2.12-20 i686, en; rv:2.0) Gecko/25250101 Netscape/5.432b1 (C-MindSpring)
A Gecko-based browser TinyBrowser/2.0 (TinyBrowser Comment; rv:1.9.1a2pre) Gecko/20201231

Implementation notes for applications, vendors, and extensions

Starting with Mozilla 1.8 beta2, the best way for applications, vendors, and extensions (if needed) to add to default preferences to add VendorProductTokens or VendorComments is to add a default preference of the form general.useragent.extra.identifier. All of the general.useragent.extra.* preferences will have their string values added to the User-Agent string in alphabetical order by identifier. For example:

  • pref("general.useragent.extra.megabrowser", "MegaCorpBrowser/1.0 (MegaCorp, Inc.)");
  • pref("general.useragent.extra.tinydistro", "TinyDistroLinux/2.3");

Comments to netscape.public.mozilla.netlib or dbaron@dbaron.org

{{ languages( {"ja": "Ja/User_Agent_Strings_Reference"} ) }}

Revision Source

<h3><span id="status">Status of this document</span></h3>
<p>This is a major revision of the <a class="external" href="http://www-archive.mozilla.org/build/user-agent-strings.html">original, obsolete, user-agent string proposal</a>. See the discussions on <a class="link-news" href="news://news.mozilla.org/netscape.public.mozilla.seamonkey"> netscape.public.mozilla.seamonkey</a> and <a class="link-news" href="news://news.mozilla.org/netscape.public.mozilla.netlib"> netscape.public.mozilla.netlib</a> for background information.</p>
<p>This document is the official Mozilla user-agent string specification. However, the following issues are under review and may be revised in the near future:</p>
<div style="border: medium solid red;">
<ul> <li>There is concern that the attempt to separate <code>Platform</code> and <code>OS-or-CPU</code> on Windows and Macintosh is not backwards compatible and the user-agent strings should return to their old-fashioned form.</li> <li>There is <a class="external" href="http://bugzilla.mozilla.org/show_bug.cgi?id=57555">concern</a> that giving the operating system version on Windows reveals too much information about a system (such as potential security holes).</li> <li>There is <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=572650">concern</a> that this can be used to fingerprint users.</li> <li>There is <a class="external" href="http://bugzilla.mozilla.org/show_bug.cgi?id=55366">concern</a> that revealing localization information is a violation of privacy.</li>
</ul>
</div>
<h3><span id="goals">Goals</span></h3>
<p>The original goals:</p>
<ul> <li>Obey the standard described in RFC 1945 and RFC 2068.</li> <li>Don't break existing web servers.</li> <li>Don't break existing log-file analysis software or user-agent parsing code.</li> <li>Keep the User-Agent string reasonably short.</li> <li>Use a consistent, obvious, and easy-to-parse format.</li>
</ul>
<p>Other concerns that came out of discussion:</p>
<ul> <li>Provide date-based version information.</li> <li>Address the issue of version modifiers.</li> <li>Provide a way for applications that contain Mozilla technology (i.e. Gecko) but are not Mozilla to identify themselves</li>
</ul>
<h3><span id="proposal">Proposal</span></h3>
<p>For browsers based on Mozilla, the user-agent string shall follow the format:</p>
<p style="margin-left: 40px;"><code>MozillaProductToken (MozillaComment) GeckoProductToken *(VendorProductToken|VendorComment)</code></p>
<p>Applications that embed the Gecko layout engine shall have user-agent strings that follow the format:</p>
<p style="margin-left: 40px;"><code>ApplicationProductToken (ApplicationComment) GeckoProductToken *(VendorProductToken|VendorComment)</code></p>
<p>Where:</p>
<table border="0" cellpadding="5" cellspacing="3" width="100%"> <colgroup><col width="25%"><col> </colgroup> <tbody> <tr style="background-color: rgb(255, 255, 204);"> <td align="right" valign="top">MozillaProductToken</td> <td><code><strong>Mozilla/</strong></code> <em>MozillaVersion</em></td> </tr> <tr style="background-color: rgb(255, 255, 204);"> <td align="right" valign="top">MozillaVersion</td> <td><em>Major</em> <code><strong>.</strong></code> <em>minor</em></td> </tr> <tr style="background-color: rgb(255, 255, 204);"> <td align="right" valign="top">Major</td> <td>Integer indicating major release number.  In practice, always 5.</td> </tr> <tr style="background-color: rgb(255, 255, 204);"> <td align="right" valign="top">Minor</td> <td>If non-zero, it shall be a three-digit, zero-filled number, i.e. <strong><code>001</code></strong>. If zero, zero is fine.  In practice, always 0.</td> </tr> <tr> <td align="right" valign="top">MozillaComment</td> <td><code>(</code> <em>Platform</em> <strong><code>;</code></strong> <em>Security</em> <strong><code>;</code></strong> <em>OS-or-CPU</em><strong><code>;</code></strong><em>Localization information</em><em><strong><code>;</code></strong> GeckoVersion <code>)</code></em><em>*[<strong><code>;</code></strong> Optional Other Comments] <code>)</code></em></td> </tr> </tbody> <tbody> <tr> <td align="right" valign="top">Platform</td> <td>Allowed values: <ul> <li><code><strong>Windows</strong></code> for all Microsoft Windows environments</li> <li><code><strong>Macintosh</strong></code> for all MacOS environments</li> <li><code><strong>X11</strong></code> for X Window System environments</li> <li>etc.</li> </ul> </td> </tr> <tr> <td align="right" valign="top">Security</td> <td style="border: medium solid red;"><em>This was removed in mozilla2.0b2 as part of <a class=" link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=572650">http-fingerprint</a>.</em><br> Allowed values: <ul> <li><code><strong>N</strong></code> for no security</li> <li><code><strong>U</strong></code> for strong security</li> <li><code><strong>I</strong></code> for weak security</li> </ul> </td> </tr> <tr> <td align="right" valign="top">OS-or-CPU</td> <td>Values for <strong>Windows</strong> systems: <ul> <li><code><strong>Win3.11</strong></code> for Windows 3.11</li> <li><code><strong>WinNT3.51</strong></code> for Windows NT 3.11</li> <li><code><strong>WinNT4.0</strong></code> for Windows NT 4.0</li> <li><code><strong>Windows NT 5.0</strong></code> for Windows 2000</li> <li><code><strong>Windows NT 5.1</strong></code> for Windows XP</li> <li><code><strong>Windows NT 5.2</strong></code> for Windows Server 2003; Windows XP x64 Edition</li> <li><code><strong>Windows NT 6.0</strong></code> for Windows Vista</li> <li><code><strong>Win95</strong></code> for Windows 95</li> <li><code><strong>Win98</strong></code> for Windows 98</li> <li><code><strong>Win 9x 4.90</strong></code> for Windows Me</li> <li><code><strong>WindowsCE</strong></code> for Windows CE</li> <li>etc.</li> </ul> Values for <strong>MacOS</strong> systems shall be: <ul> <li><code><strong>68K</strong></code> for 68k hardware</li> <li><code><strong>PPC</strong></code> for PowerPC hardware</li> <li>etc.</li> </ul> Values for <strong>Unix</strong> systems shall be the output of the command <strong><code>uname -sm</code></strong> (also accessible as the <strong>sysname</strong> and <strong>machine</strong> fields of the utsname structure.) (Previous versions of this document said they should be the output of <strong><code>uname -srm</code></strong>, but the <strong>release</strong> field of the utsname structure was considered to <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=57555">reveal too much information</a> about the system, such as potential security holes.)</td> </tr> <tr> <td align="right" valign="top">Localization Information</td> <td style="border: medium solid red;"><em>This was removed in mozilla2.0b2 as part of <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=572650">http-fingerprint</a>.</em><br> Language Tag as described in the standards RFC 1945 and RFC 2068. Examples:<br> <code>en, en-US, es, es-CO, ja, ja-JP</code>, etc.</td> </tr> <tr style="background-color: rgb(255, 255, 204);"> <td align="right" valign="top">GeckoVersion</td> <td>String starting with "rv:" followed by the Gecko version.  This is a set of numbers separated by periods, possibly followed by a pre-release indicator (e.g. "a1" for the first alpha).</td> </tr> <tr style="background-color: rgb(255, 255, 204);"> <td align="right" valign="top">GeckoProductToken</td> <td><code><strong>Gecko/</strong></code><em>GeckoDate</em> <p>The Gecko product token allows products that embed the Gecko engine, including Mozilla, to identify this significant sub-product.</p> </td> </tr> <tr style="background-color: rgb(255, 255, 204);"> <td align="right" valign="top">GeckoDate</td> <td>Date in the format YYYYMMDD. For official Mozilla builds, this will correspond to the date portion of the BuildID. For branded versions of Mozilla, the GeckoDate should correspond to the date the code was pulled from mozilla.org, and may not necessarily correspond to the date portion of the generated BuildID.  Note that the date does not identify the Gecko version if multiple branches are releasing in parallel.</td> </tr> <tr> <td align="right" valign="top">ApplicationProductToken, Application Comment</td> <td>For use by applications that embed Gecko layout engine. The form of their product token and comment is not specified here, but should adhere to the HTTP standards.</td> </tr> <tr style="background-color: rgb(255, 255, 204);"> <td align="right" valign="top">( VendorProductToken | VendorComment )</td> <td>Product tokens for applications based on Mozilla. Format and content shall be vendor-specific, but should adhere to the HTTP standards and ideally include a GeckoVersion as described above.</td> </tr> <tr> <td align="right" valign="top"><strong><code>*</code></strong></td> <td>Zero or more of the following token are allowed.</td> </tr> <tr> <td align="right" valign="top"><strong><code>?</code></strong></td> <td>Zero or one of the following token are allowed.</td> </tr> </tbody>
</table>
<h3><span id="examples">Examples</span></h3>
<table width="100%"> <colgroup><col width="25%"><col> </colgroup> <tbody> <tr> <td>A mozilla.org release</td> <td><code>Mozilla/5.001 (windows; U; NT4.0; en-US; rv:1.0) Gecko/25250101</code></td> </tr> <tr> <td>A branded release based on the same codebase as the browser above</td> <td><code>Mozilla/5.001 (Macintosh; N; PPC; ja; rv:1.0) Gecko/25250101 MegaCorpBrowser/1.0 (MegaCorp, Inc.)</code></td> </tr> <tr> <td>A re-branded release</td> <td><code>Mozilla/9.876 (X11; U; Linux 2.2.12-20 i686, en; rv:2.0) Gecko/25250101 Netscape/5.432b1 (C-MindSpring)</code></td> </tr> <tr> <td>A Gecko-based browser</td> <td><code>TinyBrowser/2.0 (TinyBrowser Comment; rv:1.9.1a2pre) Gecko/20201231</code></td> </tr> </tbody>
</table>
<h3><span id="implementation">Implementation notes for applications, vendors, and extensions</span></h3>
<p>Starting with Mozilla 1.8 beta2, the best way for applications, vendors, and extensions (if needed) to add to default preferences to add <code>VendorProductToken</code>s or <code>VendorComment</code>s is to add a default preference of the form <code>general.useragent.extra.<em>identifier</em></code>. <em>All</em> of the <code>general.useragent.extra.*</code> preferences will have their string values added to the User-Agent string in alphabetical order by identifier. For example:</p>
<ul> <li><code>pref("general.useragent.extra.megabrowser", "MegaCorpBrowser/1.0 (MegaCorp, Inc.)");</code></li> <li><code>pref("general.useragent.extra.tinydistro", "TinyDistroLinux/2.3");</code></li>
</ul>
<hr>
<p>Comments to <a class="link-news" href="news://news.mozilla.org/netscape.public.mozilla.netlib">netscape.public.mozilla.netlib</a> or <a class="link-mailto" href="mailto:dbaron@dbaron.org">dbaron@dbaron.org</a></p>
<div class="noinclude">{{ languages( {"ja": "Ja/User_Agent_Strings_Reference"} ) }}</div>
Revert to this revision