Spotting The Gecko
Recognizing A New Family of Browsers
The New Generation of Netscape Gecko Browsers
So What Is Netscape Gecko, and Who Are These Lizards?
Netscape Gecko is the rendering engine of the Mozilla open source project, initiated by Netscape Communications in 1998. It is a fast, standards compliant, and embeddable rendering engine, and forms the core of a new and growing family of prominent browsers:
The chief advantage to web sites of supporting this new family of browsers is obvious: more consumers! This article brings together resources for helping you to detect this new family of Netscape Gecko browsers. The goal is to "recognize once, serve many!"
New User Agents Declare Themselves
A user-agent string is the basic informational string that browsers present to web servers to identify themselves over the HTTP protocol. Giving companies the chance to embed Netscape Gecko raised the possibility of some confusion in user-agent strings, so mozilla.org published a specification for the user-agent strings that embedding applications ought to implement. The good news is even though the branding on various Netscape Gecko browsers is distinct, it is easy to identify them based on the commonalities in their user-agent string. In this section we'll look at some of these user-agent strings, and understand what's important about the user-agent specification.
Some Legacy Browsers and User-agent Strings
Let's take a look at two browsers that the market knows well, Microsoft's IE and Netscape Communicator. Neither is a Netscape Gecko-based browser, and both have user-agent strings that webmasters know well.
Browser User Agent String Netscape Communicator 4.78
on Windows 98
Mozilla/4.78 [en]C-AOLNSCP (Win98; U)
Microsoft Internet Explorer 6
on Windows 98:
Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
The basic format of user-agent strings for Web browsers was specified by the earliest implementations of Netscape's browsers. The beginning of the user-agent string contained
Mozilla/followed by the browser's version number. The remainder of the user-agent string was used to provide additional information about the browser and operating system being used.
In each of the above user-agent strings, you can see that this standard is still followed. The user-agent string begins with
Mozilla/followed by the version number. For Netscape 4 versions, the version number is the actual version of the browser while Internet Explorer only claims to be compatible with Netscape 4. The remainder of the user-agent string gives additional information related to the actual browser, the operating system, security and locale.
Netscape Gecko Browsers
Netscape Gecko-based Browsers, such as Netscape 6, follow the mozilla.org user-agent specification. Here's a breakdown of what the user-agent specification prescribes for the user-agent strings of Mozilla-based applications:
MozillaProductToken (MozillaComment) GeckoProductToken VendorComment
User-agent String Component Description
Netscape 6, Mozilla and other browsers based upon Netscape Gecko use
Mozilla/5.0to indicate that they are Web Browsers and that they of the next generation after Netscape Communicator 4. The presence of
Mozilla/5.0is not guaranteed to indicate a Netscape Gecko based browser since other user-agents may start reporting their version as 5.0 sometime in the future.
MozillaCommentis used to provide additional information about the browser and its environment. Please see the mozilla.org user-agent specification for more details on the exact fields and their interpretation. Essentially, the
MozillaCommentcontains the following required semi-colon delimited fields:
Platform; Security ; OS-or-CPU ; Localefollowed by the optional semi-colon delimited fields,
ReleaseVersionand Other Comments.
Gecko/followed by the build date for the browser in the format YYYYMMDD. The presence of the String
Geckois guaranteed for any user-agent based upon the Netscape Gecko Layout engine.
VendorCommentis intended to be used by Browser vendors and is not standardized in general. The Mozilla browser itself has no VendorComment; however, for Netscape and related user-agents the
VendorCommentusually contains the Browser Family/BrowserVersion.
Browser User-agent String (hover over the components of each User Agent string to see the name of the component) Netscape 6.01 on Win NT Mozilla/5.0 (Windows; U; WinNT4.0; en-US; m18) Gecko/20010131 Netscape6/6.01 Netscape 6.1 PR 1 on MacOS Mozilla/5.0 (Macintosh; U; PPC; en-US; rv:0.9.1) Gecko/20010607 Netscape6/6.1b Netscape 6.1 on WinNT Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1 RedHat 7.1 distribution of Mozilla on Linux Mozilla/5.0 (X11; U; Linux 2.4.2-2 i686; en-US; rv:0.9.2.1) Gecko/20010901 Instant AOL Service device Mozilla/5.0 (X11; U; Linux i586; AOL7.0) Gecko/20010724 AOL7.0 Instant AOL
These browsers introduce themselves as Mozilla/5.0 browsers, whereas Netscape Communicator 4.x is always a version less than 5.0, e.g. Mozilla/4.x. As of this writing, IE 6 remains Mozilla/4.0 compatible.
As can be seen, the
MozillaCommentportion of the user-agent string contains information about the computing environment the browser is installed on. You can see platform information (e.g. X11, MacOS, etc.), along with encryption strength information (U, N, or I), and locale information (e.g. en-US). The purpose of this discussion is to discuss the important aspects of the user-agent strings of Netscape Gecko browsers for detection purposes: for a detailed understanding of what values can be present in the
MozillaComment, consult the user-agent specification. A useful part of the
MozillaCommentportion of the user-agent string is the optional
ReleaseVersionattribute. This indicates the release or CVS branch used to build the particular browser. For Netscape 6.0 and 6.01 this is m18 but for Netscape 6.1 this is rv:0.9.2. The release version is an important browser version indicator. Netscape Gecko based-applications sharing the same release versions are likely to behave the same way. The current milestone binaries are available for download from mozilla.org.
The GeckoProductToken in each of the above examples contains the build date for the browser in the form Gecko/BuildDate where
BuildDateis the build date in the format YYYYMMDD. The
BuildDatein conjunction with Mozilla's open Bug Database and Source Control System gives an exact indication of what features a particular version of Gecko supports. Applications sharing the same BuildDate are likely to share the same version of Netscape Gecko, and will behave in the same way. The BuildDate is an helpful string to parse for in order to detect browser version.
The user-agent specification allows an application that embeds the Netscape Gecko layout engine to supply more information with the user-agent string:
ApplicationProductToken (ApplicationComment) GeckoProductToken VendorComment
While the specification for general applications that embed Netscape Gecko does not describe the exact format of each of these components of the user-agent string in the same level of detail as it does for browsers based on Mozilla, it does guarantee that the GeckoProductToken
Gecko/YYYYMMDDwill be present.
An example of a user-agent string for an imaginary Mozilla-based browser application compatible with other Mozilla/5.0 version browsers and built upon Netscape Gecko could be:
Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20010901 ImaginaryApp2/2.1Here, ImaginaryApp is a web browser compatible with the 5.0 versions, described as being version 2.1 of the ImaginaryApp 2 family. This particular version of ImaginaryApp was built from the Mozilla 0.9.4 milestone branch release, on 09/01/2001. The sections on user-agent based detection and client side detection offer more insights and resources into recognizing the Netscape Gecko family.
Some Common Mistakes -- Avoid Them!
Incorrectly detecting the browser version. Do not confuse the
Release Versionof the
MozillaCommentwith the version of the browser. This might lead you to incorrectly identify Netscape 6.1 as Netscape 0.9.2, a very different browser indeed.
Identifying the Netscape 6.1 family of browsers (and in fact the Mozilla/5.0 family of browsers), as just Netscape Communicator 4.x browsers. Assuming, from the
MozillaProductTokenor from the
VendorProductTokenthat a Netscape Gecko-based browser is a Netscape Communicator 4.x browser is one of the more common erroneous detections. Serving Netscape Gecko browsers Communicator 4.x content results in a less than optimal user experience, and in some cases, broken web sites! In addition to correct sniffing, web content can easily be upgraded for Netscape Gecko browsers.
Identifying the Netscape 6.x browser correctly, but not identifying other Gecko based browsers. This problem occurs if the web programmer only searches for the string Netscape6 but ignores the
GeckoProductToken. This is an unnecessary loss of customers since all Gecko browsers can be served the same content. A manifestation of this problem would be if you were to identify Netscape 6.1 based on the
VendorProductToken, but in ignoring the
GeckoProductToken, you'd also ignore browsers that embed Netscape Gecko that behave just like Netscape 6.1.
User-agent Detection Suggestions
This section suggests methods of detecting Netscape Gecko-based browsers from the user-agent alone. Such detection usually occurs on the server side. The goal is to let the entire family of Netscape Gecko browsers benefit from sniffing decisions, since they all share the same layout engine.
Always look for the
GeckoProductToken.Identifying a browser as a Netscape Gecko browser, instead of Netscape 6.x, is beneficial since you can decide to serve consistent standards based content to all Netscape Gecko browsers. Unless fine grained access control is required, generally detecting Netscape Gecko by looking for "Gecko" in the user-agent string may be sufficient.
Fine grained access control becomes an issue if it becomes necessary to detect specific versions of individual Netscape Gecko browsers. For example, it may be necessary to distinguish between beta releases and final releases. Here's what we prescribe for this type of "selective" detection:
VendorProductTokenfor a definitive version clue. Suppose that it was desirable to block beta or "trial" browsers from accessing a bank site, which only supports final candidate releases. Recall that the user-agent string for Netscape 6.1 Preview Release looked like this:
Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.1) Gecko/20010607 Netscape6/6.1b
GeckoProductToken("Gecko/20010607") is the
VendorProductTokenstring "Netscape6/6.1b". Tokenizing this string on the slash ("/") yields the substring "6.1b", suggesting that this is a beta of the Netscape 6 browser. In general, if you wished to determine the beta status of Netscape 6.x browsers you're well served by this technique, since the b following the version number gives away the beta or "Preview Release" status. This technique isn't as charitable towards all Netscape Gecko browsers, however, since it relies on the
VendorProductToken.Generally, where the
VendorProductTokenis known to carry information about beta status, parsing the
VendorProductTokenremains an efficient way to determine the beta status of the browser.
Parsing the release version number for clues based on milestone information. Note that a "quick and dirty" method to determine whether a Netscape browser is Netscape 6.x or Netscape 6.0x is the form the release version takes -- for Netscape 6.0x browsers such as Netscape 6.01, the release version is based on the old milestone system, e.g. "m18". For Netscape 6.1 PR1, the milestone nomenclature has changed to "rv:0.9.1".
Adapting the example above, let's say we wished to selectively detect Netscape 6.1 PR1, which is a beta release. As above, we could detect the "b" part of the
VendorProductToken, but what if there were other embedding applications that used the Mozilla 0.9.1 milestone on which this beta is based? Might we not wish to block them also? Thus, we could parse the release version and determine the "0.9.1" part, and selectively detect all browsers that use this release version. We might even establish a landmark release version, deciding that Mozilla 0.9.2 ("0.9.2") and family ought to be selectively detected, and that any milestone after 0.9.2 were to be selectively detected. We might decide to make available content for 0.9.2 and up by means of a comparison on 0.9.2.
In general, "rv:0.9.2" is a good landmark release version, since it was what Netscape 6.1 was based on. Additionally, note that the most recent RedHat Mozilla distribution contains "rv:0.9.2.1" and would be included in a greater-than or equal-to comparison to 0.9.2. However, individual web developers may wish to ascertain their own landmark release versions based on information they've gained from Bugzilla, the open bug database or mozilla.org releases. Some information, however, may yet slip through the cracks by only looking at such milestones. That's why the
BuildDate, and making decisions based on
BuildDate. Whereas milestones are effective methods for selectively zeroing in on a particular browser, the possibility exists for bug fixes to occur to a particular browser which is based on a given milestone. In that case, how does one distinguish between a milestone containing the fix and one that doesn't? Clearly, revision version alone won't suffice.
Recall that the user-agent string for Netscape 6.1 contained the GeckoProductToken "Gecko/20010726". Just as we had landmark revision versions, it's possible to have landmark GeckoVersions.. Once again, tokenizing the above BuildDate results in "20010726", which can serve as an identifying comparison (e.g. consider a greater than or equal to operation on the value 20010726). Any Netscape Gecko browser coming after 07/26/01 should have at least the same subset of features that you know from Netscape 6.1. Furthermore, any browser coming off the revision version that Netscape 6.1 is based on (Mozilla 0.9.2, or "rv:0.9.2") having a
GeckoVersiongreater than or equal to 20010726 ought to have at a minimum all the features understood on that milestone as of 07/26/01. In general, "20010726" is a good landmark
BuildDate,since it was what Netscape 6.1 was based on. Using it as a landmark date covers significant Netscape Gecko browsers using builds of Gecko after 07/26/01, such as the recent RedHat Mozilla distribution (20010901 -- 09/01/01). However, individual web developers may wish to ascertain their own landmark
GeckoVersions based on information they've gained from Bugzilla, the open bug database or mozilla.org releases .
Client Side Detection Concerns
Netscape Gecko browsers closely adhere to the W3C Web Standards . Perhaps one way to determine what content to give it is not on the basis of user-agent string, but rather, on the basis of the supported Document Object Model (DOM) and other standards. Might it not be useful to determine whether the browser in question supports the Core aspects of the DOM, or whether it supports CSS1 and 2?
The Object Oriented client Sniffer adds OOAD mechanisms for detecting Netscape Gecko.
Both Netscape and Mozilla browsers are localized into many different languages. Other Netscape Gecko-embedded browsers or devices may also be localized into different languages. For example, the US English version of the official Netscape 6.1 release on Windows NT bears the following user-agent string:
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1while the Japanese version of the official Netscape 6.1 release shows the following:
Mozilla/5.0 (Windows; U; Windows NT 5.0; ja-JP; rv:0.9.2) Gecko/20010726 Netscape6/6.1
Note that the language-locale/region of localization is indicated, i.e. en-US and ja-JP, within a comment for the MozillaProductToken. Otherwise the two user-agent strings are identical. So, a natural question would be:
What functional differences are there between different localized versions sharing the same release version and GeckoProductToken?
The answer is: there are NONE!
All language versions of Mozilla-based browsers are internationalized and capable of processing data/pages in many
different languages. All that a localizing process does to a particular release version with the same
GeckoProductToken is to turn the User Interface menus and dialogs into the target language. The process preserves all
core functionalities, adds nothing new nor subtracts anything from existing functionalities. That is, Netscape 6.1 is
Netscape 6.1 no matter what language version it is. Thus, except under rare circumstances when detecting a language of
localization is necessary, the techniques discussed above for detecting browser versions and features are applicable to any
language edition of the same release version with the same
Developing For Netscape Gecko Browsers: Resources
Supporting Netscape Gecko based browsers is important for web sites who not only care about standards, but also about future "lizard spawn:" desktop browsers and appliances.
Here are some resources to help you write standards compliant code for Netscape Gecko: