JavaScript Editor JavaScript Debugger     JavaScript Editor 

Team LiB
Previous Section Next Section

Mozilla-Based Browsers

Mozilla-based browsers such as Mozilla, Firefox, Camino, and Netscape 6+ are the browsers of choice for many technical users. They are also the most popular browsers for users on UNIX-like platforms such as Linux and BSD. If your user demographic includes highly technical users, or you’re running an intranet site devoted primarily to Linux developers, awareness of the features supported by Mozilla-based browsers can be very useful.


In March 1998 Netscape released to the open source community a cleaned-up version of its browser source code as “Mozilla.” Mozilla was the internal code name for Netscape browser products and is derived from “Mosaic killer,” a reference to the first popular graphical browsing tool for the Web. These days, “Mozilla” refers to a browser, a platform, and an organization. Mozilla the browser is a cross-platform, open source browser, the components of which can be easily reused as a base on which to build your own browser. Mozilla the platform is a cross-platform application development framework on top of which Mozilla the browser and many other applications are written. Mozilla the organization is an independent group of developers devoted to maintaining and extending both Mozilla the platform and Mozilla the browser.

The shift of the development of “core” Netscape browser features into the Mozilla open source project explains the absence of a Netscape 5. The code that was released as Mozilla was to have formed the basis for Netscape 5. However, Mozilla (the organization) decided it would be better to rewrite most of the browser from scratch. Since future versions of the Netscape browser were to be based on Mozilla (the browser and platform), the release of Netscape 5 was canceled.

Though many of the major contributors to the Mozilla project are Netscape/AOL employees (or former employees), the Mozilla source code can be incorporated into any browser release by anyone willing to spend the effort, subject to certain licensing restrictions. This is exactly what Netscape did for Netscape 6. They waited until the Mozilla project had reached sufficient maturity and then incorporated its source code (and that of related open source projects) into a completely new browser and dubbed it Netscape 6. You can picture vendors of Mozilla-based browsers like Netscape taking a “snapshot” of Mozilla (and related) source code at a particular point and forking off on their own development branch. It is for this reason that although Netscape 6+ and other Mozilla-based browsers are not the same thing as Mozilla, they are very closely related, so often developers speak of Mozilla and Mozilla-based browsers interchangeably.


Interested readers can learn more about the various faces of Mozilla at If you’re interested in trying out a Mozilla-based browser, we highly recommend trying Firefox, a slimmed-down version of the Mozilla browser that is very fast. You can download it at And remember: because Mozilla is an open source project, interested readers can also write code for the browser, thereby achieving everlasting net. fame.

Standards Support

The advent of Mozilla-based browsers marks a stark departure from traditional browser trends. Mozilla-based browsers emphasize implementation and adherence to W3C and ECMA standards, providing hope that one day standard code can be written once and run equally well on many different platforms and browsers (where have we heard that before?). Although the Mozilla project was greeted with much skepticism, time has shown that Mozilla-based browsers such as Firefox are quality products on a number of fronts, not the least of which is standards support.

Table 21-15 shows standards support in Mozilla-based browsers. Closer examination of the table reveals that you can use standard DOM techniques for events and DHTML in Mozilla-based browsers. The so-called DOM0 is supported for backward compatibility, as are the screen position–related properties of Netscape browsers and the ability to do plug-in and MIME type sensing (see Chapter 18). And finally, some useful but non-standard features such as the innerHTML property of element objects are also present.

Table 21-15: Standards Support in Mozilla-Based Browsers


Support Standard


HTML 4, XHTML1.1, XML, XML Namespaces, XLink (partial), XPath, MathML, and other related XML technologies


CSS1 (full), CSS2 (partial), DOM2 Style (mostly), and XSLT


ECMA-262 Edition 3 (JavaScript 1.5)


DOM0, DOM1, DOM2 Core (mostly), DOM2 Events (mostly), andDOM2 Style (mostly)


Standards support in Mozilla-based browsers is always improving, so check for up-to-date information.

Knowing what standards Mozilla-based browsers support is helpful, but you might get unexpected results if you aren’t aware of the circumstances under which Mozilla applies these different technologies.

Standards Versus Quirks Mode

Mozilla has three different modes in which it can interpret markup and style. If your markup isn’t working as desired in Mozilla-based browsers, you should add the appropriate DOCTYPE to ensure the browser enters the correct mode. These modes and the conditions causing the browser to enter them are listed in Table 21-16. Note that the conditions listed are just a general rule; Mozilla actually applies some sophisticated “mode sniffing” logic to determine which mode to enter. For complete information, see

Table 21-16: Mozilla-Based Browsers Interpret Pages Differently Based on Their DOCTYPEs


Triggered By



A strict DOCTYPE

Interprets pages in strict accordance with the (X)HTML and CSS standards. This means that browser doesn't perform “fix-ups” for broken markup or style.

Almost Standards

A transitional DOCTYPE

Interprets pages in accordance with the (X)HTML and CSS standards, but permits some deprecated (X)HTML markup and renders some aspects of the page (such as images as table backgrounds) as older browsers do.


Absence of a DOCTYPE

Pages are interpreted “traditionally,” that is, they may contain deprecated or invalid markup. Also, the browser will “fix up” broken (X)HTML and style as best it can,
for example, interpreting <font color="333"> as
<font color="#333333">.

Proprietary Browser Features

Because Mozilla emphasizes standards support, it doesn’t have the huge list of proprietary features that a browser like Internet Explorer does. In fact, there’s really only one major proprietary feature that’s noteworthy: signed scripts. A signed script is JavaScript packaged with (X)HTML markup and digitally signed so as to guarantee its origin. Because its origin can be guaranteed, the script is able to request extended privileges, for example, the ability to modify browser settings or read the browser’s history.

We touch briefly on signed scripts in Chapter 22, but the details of the technology are outside the scope of this book. If you’re an intranet developer whose target audience has mostly Mozilla-based browsers, you should read up on the capabilities and mechanics of signed scripts, currently at (or simply search for mozilla signed scripts).

Mozilla the Platform

One of the most compelling products of the Mozilla foundation is Mozilla the platform. Mozilla the platform is an application development framework that works across most OSs you could imagine, and many you might not. Many Mozilla-based browsers (including Firefox, Camino, and Mozilla itself) are implemented on the Mozilla platform, as are applications like Thunderbird, the Mozilla foundation’s mail and news client. But the applications you can develop with the platform aren’t limited to those that use the Web; it is well suited for general application development.

The architecture of the Mozilla platform is novel, and is intended to make application development more like Web development. This means that it is relatively easy for Web developers to learn (relative to other platforms such as Win32), and, like Web pages, relatively easy to modify existing applications. The components making up the Mozilla platform are listed in Table 21-17.

Table 21-17: Components of Mozilla the Platform

Application Component

Technology Used


UI structure

An XML-based markup language called XUL

XUL is like HTML, but instead of tags like <p> and
<h1> you use markup like <menubar><menuitem label="Save as... "> to create UI elements.

UI presentation


The familiar CSS is applied to the structural UI elements defined in XUL to give them their appearance.

UI content


Localizable string tables in the form of DTDs can be used to completely separate the text content of the interface from the interface's structure and presentation.

UI logic


JavaScript is used to automate the user interface. Script handles events in the user interface just like it can handle events in a Web page, and typically calls into application logic to do the heavy lifting.

Application logic

Your choice: JavaScript, C, C++, Perl, Python, etc.

Modular components carry out the “real” application work. They can call native interfaces or use the Netscape Portable Runtime Library, a cross-platform library for common tasks such as networking, file I/O, and the like. Note that application logic can be written in JavaScript,
so you could easily implement an entire application without resorting at all to a compiled language!

The benefits of developing on such a platform are many, but a primary one is that rapid prototyping is very easy, and modifying existing applications to fit your needs is even easier. Getting cross-platform functionality so your application runs on MacOS, Linux, and other OSs in addition to Windows is another major benefit. But perhaps the most compelling reason to use Mozilla the platform is that it makes application development easier by sticking to the well-known paradigms of Web development.

You can find more information about the Mozilla platform at or in the book Rapid Application Development with Mozilla by Nigel McFarlane.

Team LiB
Previous Section Next Section

JavaScript Editor JavaScript Debugger     JavaScript Editor