[BNM] Designing for Netscape 4

Jeremy Keith bnmlist@brightonnewmedia.org
Fri Mar 7 17:10:15 2003


Jon wrote:
> I want to make the IE scripts more cross-browser compatible, and I am 
> becoming more interested in the behaviour of the underlying DOM of 
> various browsers.

If you stick to the W3C DOM then your scripts will be executable by 
IE5+, Netscape 6+ and any other up-to-date browsers (Safari, Phoenix, 
etc.)

>> http://thesession.org/
>
> I like the elegant simplicity of this in version 5+ browsers and in 
> some
> respects is like the kind of visual aesthetic I am trying to achieve. 
> Has
> this been done solely using a set of style sheets with varying 
> complexity and
> the @IMPORT directive?

For the visual layout, yes. For the scripting, it uses the DOM. To stop 
older browsers choking on it, I simply included a test for DOM 
compliance with this little wrapper:

if (document.getElementById)

It's the JavaScript equivalent of the @import method in CSS; browsers 
that are smart enough to understand it pass the test. Older browsers 
just carry on, blissfully unaware, without any error messages.

Whatever you do, in your JavaScript or server-side scripting, do *not* 
sniff for specific browsers. It'll only end in tears. Sniff for what 
you want to support instead.

So if, for example, you had temporarily lost your mind and you wanted 
to build a site that only worked in using Netscape 4's proprietary 
Document Object Model, instead of sniffing the browser agent and 
version number, you would just check to see if document.layers exists.

By the way, something that hasn't come up in this discussion (and 
probably doesn't need mentioning because I'm sure most people know this 
already) is that Netscape 6 has nothing to do with Netscape 4. Zilch. 
Zip. Nada.

...okay the name is similar, but apart from that it's a completely 
different beast with a completely different rendering engine and 
Document Object Model. Netscape 6 doesn't include backwards 
compatibility for Netscape 4's proprietary Document Object Model.

In a nutshell; even Netscape don't support Netscape 4!

HTH,

Jeremy

-- 
Jeremy Keith

a d a c t i o

http://adactio.com