dcsimg

Netscape 6, Part I: Detection and Scripting Page 4

By Yehuda Shiran (Send Email)
Posted Dec 5, 2000


The line above should be tan in Netscape Navigator. It should have a white background in Internet Explorer because IE silently ignores the LAYER tag. Similarly, Netscape 6 does not support this tag and the line above should have a white background in Netscape 6.

When Netscape 6 silently ignores the LAYER and ILAYER tags, it also ignores their attributes. These attributes include the SRC attribute by which the LAYER element links external files. The behavior of such an element is not intuitive. In Netscape Navigator, the linked in external file determines the content of the LAYER element. Since the SRC attribute is ignored in Netscape 6, the content of the LAYER element is determined by whatever is written in the HTML file between the <LAYER> and the </LAYER>. Let's take an example. The following HTML should link in a GIF file in Netscape Navigator, and should ignore the current content of the tag:

<LAYER SRC="bc.gif">
This LAYER tag links in a small GIF file (the local page mark in the columns' navigation links).
</LAYER>

Convince yourself it's working fine in Netscape Navigator. In Internet Explorer and Netscape 6, The GIF should vanish and the content rendered is the line above, "This LAYER tag links...":

<LAYER SRC="bc.gif"> This LAYER tag links in a small GIF file (the local page mark in the columns' navigation links). </LAYER>

Similarly to the LAYER tag, Netscape 6 does not support the NOLAYER tag. As discussed above for the LAYER tag, Netscape 6 will ignore any attributes of the LAYER tag, including the SRC attribute, which is used to import external files. Netscape 6 will render, though, any tags placed between the <NOLAYER> and </NOLAYER> tags. We now have a simple way to make a page two-way browser-independent between Netscape Navigator and Netscape 6. Place Netscape Navigator-specific content in an external file and reference is by a <LAYER SRC=...> or <ILAYER SRC=...>. Netscape 6 will ignore it silently. As for Netscape 6's specific content, enclose it between <NOLAYER> and </NOLAYER>. Netscape Navigator will silently ignore these tags and whatever is enclosed between them, while Netscape 6 will silently ignore these tags, but will render everything that is enclosed between them.

Netscape 6 does not support document.layers and other layer DOM features. Do not use the layer DOM in your JavaScript scripts either.

Netscape Navigator supports several properties and methods for setting CSS properties from JavaScript: document.tags, document.ids, document.classes, and document.contextual. Netscape 6 does not support them, so avoid them altogether.

In summary, when starting a new development, avoid the following:



Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.