Vol. 1, No. 42
Nifty New Browser, Tra La, Tra La
Well, Netscape 6 has been released. That's significant in a few
different ways. For those who avidly follow the browser wars, it's yet
another skirmish to watch, and another chance to cheer or boo from the
sidelines. For those who have been rooting for the Mozilla project for
years now, this is its first official Netscape-branded release, and, as
such, it's yet another corporate stamp of approval for the world of
open-source software. And for us Web builders, it's a new platform that
we have to make sure our pages render correctly on. But don't think of
it as a burden -- think of it as a wonderful, wonderful opportunity.
(A brief explanatory note for those of you who are wondering what
happened to the number 5: Shortly after the release of Netscape
Navigator 4, Netscape decided to open up the source code to their
browser. That "open release" was version 5, but the developers decided
to discard the majority of the code and start anew. So 5 was scrapped
without ever making it to market. The open coding project is known as
Mozilla, and this release of Netscape, version 6, is just one
implementation of the Mozilla code. You can also get Mozilla proper, the
free browser; or other browsers built on the Mozilla base. The tips in
this newsletter apply to all such browsers, but we'll just talk about
"Netscape 6" to save typing.)
Netscape Navigator 4 has certain proprietary features (some of you are
saying that calling them "features" is too charitable) that make life a
little more difficult for us. These deviations from the official W3C
specification require little work-arounds. Even more working around is
required to build a site that uses DHTML and CSS and that looks good on
both Netscape and Internet Explorer. Pretty much the only way to do it
is to sniff out which browser your visitors are using, and serve up
appropriate code accordingly: LAYER tags for Netscapes, DIV tags for
Explorers.
The difficulties posed by Netscape 4 are exactly what make Netscape 6
such a welcome addition to the family of platforms we bold builders have
to deal with. Internet Explorer 5 is pretty darn close to compliant with
the standards set out by the W3C; now, with the release of version 6,
Netscape Navigator is compliant too. Which means no more work-arounds
for proprietary tags. The problem, of course, is that, until they all
upgrade, we have to deal with the people who are still using the old
version as well.
In the meantime, here is what you need to know to build sites for
Netscape 6. The developers have decided that LAYER and ILAYER are
stupid, and as a result Netscape 6 flat-out ignores those tags.
Likewise, the tidbits that were added to the Document Object Model in
Netscape 4 -- things like document.layers[], document.tags,
document.classes -- are not supported by the new browser. Sigh. Just
when they had started to feel like part of the family. And, last but not
least, the SRC attribute to the DIV tag, which can be used in Netscape 4
to load content from another file into an HTML page, has been dropped
like yesterday's potato.
The good news is all the fantastic stuff that version 6 DOES support.
The so-called DOM level 1 requirements are all met: HTML 4.0, CSS1, XML,
XUL, and RDF are all fully supported. In addition, there are elements of
CSS2, and DOM level 0 backwards compatibility with third-generation
browsers. All in all, a very handsome package.
If your site doesn't take advantage of DHTML and CSS features -- that
is, if it looks the same on third- and fourth-generation browsers --
then you don't have anything to worry about. You can stop reading here,
and go do something productive with your day. If, however, your site's
code has more LAYERs than a wedding cake, you have a bit of modifyin' to
do.
Download the new browser and check out how your site looks with it. If
you're using browser-detection code, what does that code make of
Netscape 6? If Netscape 6 is getting all the LAYER stuff that's meant
for Netscape 4, things won't work right at all. Make sure that Netscape
6 users are not getting any LAYER tags. One simple technique to fix the
breakage is to modify the detection code so it sends the HTML designed
for third-generation browsers to Netscape 6. N6 users won't get the
DHTML goodness that N4 folks get, but at least the site won't be broken.
This is a good interim measure until you find the time to really spiff
things up.
Another option is to remove all the LAYER, etc. stuff, and make your
Netscape 4 users live without DHTML. Instead, focus your efforts on
making snazzy CSS pages that work beautifully on IE 4 and 5, and on
Netscape 6.
If it's really vital to you that all your users have the best experience
they can, and that includes DHTML for N4 users, you're going to have to
go in and recode a lot of stuff. You'll want to detect what browser your
visitors are using, and have at least four different chunks of code
prepared, for N3 and IE3 users; N4 users; IE4 and 5 users; and N6 users.
Try using the DIV-style DHTML as a basis for the N6 code. You'll have to
change a few things. IE supports features such as document.all and
document.styleSheets[], and the MARQUEE tag, which, you will find, N6
does not. So get to work.
If only we could get all our users to migrate to version 6 immediately.
Gradually, if the gods of the Web are willing, all browsers will become
totally standards-compliant, everyone will use whatever browser they
want, and "This site best viewed with..." banners will become quaint,
amusing relics.
HINTS, POINTERS, AND TIPS 'O THE TRADE:
To see how standards-compliant your site is, try viewing it with Amaya,
the testbed browser that the W3C, creator of the HTML standard, uses to
model how things are really supposed to work. You can download Amaya
here:
http://www.w3.org/Amaya/
If you missed our recent issue about how to detect what browser your
site's visitors are using, check it out:
Using JavaScript for Browser Detection
The secret to keeping warm in cold weather is keeping your head warm. If
you have a good enough hat, you don't even need a coat.
RESOURCES:
Netscape 6
The W3C
Netscape's page about transitioning to the Mozilla code
Webmonkey: "Is Your Site Ready?"
Webmonkey on DHTML