MozillaZine

Making Your Web Page Compatible with Mozilla

Wednesday September 4th, 2002

Nicolás Lichtmaier has written a guide that explains how to make standards-compliant web pages that work with Mozilla. The article concentrates on differences in the implementations of JavaScript and the DOM in Internet Explorer and Mozilla.


#13 I think of it the other way...

by schapel

Thursday September 5th, 2002 8:21 AM

You are replying to this message

I think of making a web page that will work with a variety of browsers the opposite way -- the difficult part is not getting it to work in Mozilla, but getting it to work in IE, Opera, and older versions of Netscape.

If I wrote instructions for making a web page compatible with most browsers, I'd suggest the following:

1. Select the DTD you want to use -- transitional HTML, strict HTML, or XHTML. I couldn't recommend XHTML because it's not supported well in non-Gecko browsers. I'd instead recommend strict HTML because most browsers render transitional HTML in quirks mode, not according to W3C standards.

2. Get the web page to work in the latest release of Mozilla. Mozilla has lots of tools to help in this step, such as JavaScript strict mode and the Venkman JavaScript debugger. Some other features that would help are covered by bug 6211 <http://bugzilla.mozilla.org/show_bug.cgi?id=6211> (View page errors), bug 47108 <http://bugzilla.mozilla.org/show_bug.cgi?id=47108> (Hook up HTML quality indicator to status bar for notification of page errors), bug 79612 <http://bugzilla.mozilla.org/show_bug.cgi?id=79612> (Source file links in JavaScript console should jump to line number of problem), and bug 104383 <http://bugzilla.mozilla.org/show_bug.cgi?id=104383> (Ability to go to specific line number in View Source window).

3. Validate the HTML and CSS using the W3C validators.

4. Get it to work in the oldest version of IE and Opera you care to support. This is where the tips above really help minimize the changes to the JavaScript. Supporting IE 5 will allow your page to work for most visitors. Keep this step in mind when doing step 2 so you try not to use parts of CSS and the DOM that these browsers cannot handle. After doing this step, go back and repeat steps 3 and 4 to make sure it still works in Mozilla and validates.

I wouldn't bother supporting other browsers unless the web pages on the site are expected to get millions of hits. Instead, let the makers of the other browsers upgrade their browsers to support the parts of the HTML, CSS, JavaScript, and DOM standards you're using. Let your visitors upgrade their browsers to a newer version.