Netscape 4

Last major update: 15 July 2003

Much to everyone's disgust Netscape 4 is still a current browser.

Fact sheet:


When it was released back in 1997, it looked as if Netscape 4 was to continue the Netscape tradition of truly innovative, high quality browsers. And, true, as long as you coded your sites for the Version 3 browsers, Netscape 4 was a delight to work with. You could even add a little bit of CSS, giving an extra touch for the Version 4 users. Netscape 4 supported layers and it was whispered that the layers could do real DHTML, although no one as yet knew exactly what this was good for.

In the Version 4 era, the weaknesses of Netscape 4's architecture become very clear, both because the DOM is fundamentally too complicated and because its implementation is buggy (see the DOM page for more information). The more CSS/DHTML pages I wrote, the more quirks and problems I encountered.

Netscape 4.06 till 4.71 were very bad and very buggy, as opposed to earlier and later versions, which are merely bad and buggy. Don't test your sites in any Netscape in the danger zone, it'll only give you a headache.

Because Netscape 4's code engine turned out to be unworkable, Netscape dediced to open its source code and allow the Mozilla Project to build a new version. This has resulted in the Mozilla browser.


Netscape 4's CSS capabilities are piss poor. Try any CSS in Netscape 4 and a normal browser and you'll see what I mean. To solve the problem, use this bit of code:


Netscape 4 doesn't support the @import declaration, so any styles you define in notfornn4.css (or however you want to call the style sheet) are not read and cannot give trouble. My current strategy is to look at a page in Netscape 4 and move all problematical styles to the imported style sheet. The result is a badly styled or unstyled page, but I don't care any more. We've done enough.

Note the double quotes ". If you use single quotes Explorer Mac will also refuse to load the style sheet, which is usually not what you want.

Netscape 4 on Windows can crash on heavily styled and layered pages. I had terrible problems because I wanted to have a complicated DHTML page in the navigation frame. It turned out that Netscape 4 might crash on the border declarations in the style sheet. When I removed the border declaration I received a few mails from glad users who could once again enter my site without crashing immediately.

Furthermore, Netscape 4 can lose some bits of the style sheet on several occasions.
This is worst on the Mac, where Netscape simply disregards the style sheet after the user resizes the window.
Netscape 4 on Linux is less likely to crash than the Windows version, but it doesn't support quite as much style declarations either. Furthermore, support for some events is missing.
Netscape 4 on Windows can also lose bits of style information on a resize (background color for instance), but of the three it is the most uncompromising: either it crashes or it shows something halfway decent.

Setting the page margins to zero is difficult. Just

body {margin: 0px;}

doesn't work. The trick is:

body {margin:-10px 0 0 -10px}
html body {margin:0}

The -10px solve the Netscape 4 problems, and the html body syntax, which Netscape 4 doesn't understand, overrules the negative margin in all other browsers.


Netscape 4's JavaScript capabilities were quite good in its day, except for the too complicated DOM. Nonetheless nowadays it's way behind times with DHTML. Netscape 4 only supports the changing of top, left, zIndex, visibility, clip, backgroundColor and backgroundImage. All other styles are unchangeable. Besides, you can only change the style of an element when it has a position: absolute or relative.

Need I say more?

However, the quality of its Error Messages are a blessing to the weary scripter. From Netscape 4.06 onwards, the good old JavaScript Error Message Alert has been discontinued and replaced by the JavaScript console. You can now type javascript: in the location bar to start the console.

See the Netscape 4 Events page for everything related to event handling.

Error messages

However, it's possible to either get the old error messages or to have the JavaScript console open whenever an error occurs. In both cases you have to edit the file prefs.js which resides somewhere in your Netscape 4 folder. Close Netscape, add either of these two lines to the file, then start Netscape again:

For traditional error messages:


For automatic opening of the console:


See also for a good article on JavaScript debugging.


In short, Netscape 4 is the weakest of the Version 4+ browsers. It has acquired a status not unlike Explorer 3 used to have: the browser it's hard to code for. As the number of Netscape 4 users has started its inevitable decline, people will go to less and less trouble to write Netscape 4-friendly pages. I myself have given up on it.