Netscape 6, Part I: Detection and Scripting: Avoiding Netscape's Proprietary Features - Doc JavaScript
Netscape 6, Part I: Detection and Scripting
Avoiding Netscape's Proprietary Features
Netscape 6 does not support the LAYER
and ILAYER
elements. This means that the browser will silently ignore the <LAYER>
, </LAYER>
, <ILAYER>
, and </ILAYER>
tags. The browser will render the HTML page as if those tags are not present. Any other elements (non-LAYER
) between <LAYER>
and </LAYER>
will be rendered as if the <LAYER>
and </LAYER>
are missing. Obviously, this will change the look of the page. Let's take an example. The following LAYER
element includes one line of text:
<LAYER BGCOLOR="tan">
In Netscape Navigator, this line should be colored tan.
Should be white in Netscape 6 and IE.
</LAYER>
Here is the rendering of this element on your browser:
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 external file read in using the SRC
attribute 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...":
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:
document.layers
and other features of the Layer DOM- document.tags, document.ids, document.classes, and document.contextual()
LAYER
,ILAYER
,NOLAYER
BLINK
Next: How to avoid Internet Explorer proprietary features
Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: December 4, 2000
Revised: December 4, 2000
URL: https://www.webreference.com/js/column72/5.html