> To my surprise Netscape 6.0 seems to ignore my scripts

Are you, by any chance, hiding your scripts from older browsers with

<script type="text/javascript"><!--

hack? If so, you'll be surprised and unthrilled to know that this
doesn't work in true XHTML parsers. Because XML is a simplified markup
language with no concept of "anything that lives inside tag <x> is
non-XML content", anything you put inside <script> is parsed as XHTML.
This will cause you problems if your script contains '&' or '<'
characters. And as a side-effect, it means anything between <!-- and -->
is a comment, and will be stripped out of the document before the
JavaScript interpreter ever gets a chance to see it.


A. Avoid embedded scripts. Use linked scripts instead where possible.

B. Remove the <!-- --> and avoid '&' and '<' in your script. Pre-HTML
3.2 browsers will see your script code, but there aren't that many
pre-HTML 3.2 browsers these days.

C. Put the script in a <![CDATA[ ... ]]> block. This will tell XML
parsers that the enclosed content is non XML-encoded, so you can happily
include whatever characters you like in it (short of ']]>', obviously).
But it'll screw up anything that tries to parse the XML as old-style
HTML, which is most browsers.

D. My Evil Mangled Comments Hack (TM). This interposes markup in such a
way that it can be perfectly valid and understood identically by XHTML
and HTML parsers, and be ignored by pre-HTML 3.2 tagsoup parsers. The
drawback is that it looks, well, like this:

<script type="text/javascript"><!--//--><![CDATA[//><!--

which is, eh, a little bit ugly. Works though. Incidentally if you want
to include embedded stylesheets, the analogous Evil Mangled Comments
Hack is:

<style type="text/css"><!--/*--><![CDATA[/*><!--*/