Netscape DevEdge

Skip to: [content] [navigation]

This resource is obsolete and is provided for reference purposes only.Please see Browser Detection and Cross Browser Support for the latest information.

Spotting The Gecko

Recognizing A New Family of Browsers

The New Generation of Netscape Gecko Browsers
Artistic Gecko

Contents






Running Gecko


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:

Atlas Gecko

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.

  1. 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.

  2. 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
    MozillaProductToken Netscape 6, Mozilla and other browsers based upon Netscape Gecko use Mozilla/5.0 to indicate that they are Web Browsers and that they of the next generation after Netscape Communicator 4. The presence of Mozilla/5.0 is 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.
    MozillaComment The MozillaComment is 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 MozillaComment contains the following required semi-colon delimited fields: Platform; Security ; OS-or-CPU ; Locale followed by the optional semi-colon delimited fields, ReleaseVersion and Other Comments.
    GeckoProductToken Consists of Gecko/ followed by the build date for the browser in the format YYYYMMDD. The presence of the String Gecko is guaranteed for any user-agent based upon the Netscape Gecko Layout engine.
    VendorComment The VendorComment is 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 VendorComment usually contains the Browser Family/BrowserVersion.

    Examples

    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 MozillaComment portion 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 MozillaComment portion of the user-agent string is the optional ReleaseVersion attribute. 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 BuildDate is the build date in the format YYYYMMDD. The BuildDate in 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.

    An Embedded Netscape Gecko Application

    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/YYYYMMDD will 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.1
    
    Here, 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!

  1. Incorrectly detecting the browser version. Do not confuse the Release Version of the MozillaComment with 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.

  2. 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 MozillaProductToken or from the VendorProductToken that 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.

  3. 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.

Client Side Detection Concerns

The Client Side detection problem via JavaScript sniffers has been addressed already in various other articles. The problems posed by the above user-agent detection suggestions apply to the client side as well, and tokenizing the user-agent may be necessary for the desired level of fine grain detection. This section attempts to bring together some of these resources.

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?

International Concerns

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.1
while 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 GeckoProductToken.

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:

A+R