Netscape 6, Part I: Detection and Scripting: Avoiding Internet Explorer's Proprietary Features - Doc JavaScript | WebReference

Netscape 6, Part I: Detection and Scripting: Avoiding Internet Explorer's Proprietary Features - Doc JavaScript


Netscape 6, Part I: Detection and Scripting

Avoiding Internet Explorer's Proprietary Features

Since both Internet Explorer and Netscape 6 each claim to be the best W3C-compliant browser, Netscape 6 is closer to Internet Explorer than to Netscape Navigator. The first and foremost noticeable difference is that Netscape 6 does not support the document.all property. This property is in the heart of many JavaScript scripts, ours included. We even sniff for Internet Explorer by checking the existence of document.all in the browser. We showed you earlier in this column how to detect for Netscape 6, using the document.getElementById method. In fact, instead of using document.all to access elements, get them directly by document.getElementById(). If, for example, you would access an element in Internet Explorer that has an ID="foo" by document.all.foo, you would now reach it by document.getElementById("foo").

Netscape 6 does not support the Internet Explorer's proprietary MARQUEE tag. The following piece of HTML creates an effect of animation. The statement "Hello There..." scrolls to the right, every a fixed amount of time:

<MARQUEE BEHAVIOR="scroll" DIRECTION="right">Hello there...</MARQUEE>
Hello there...

There is no substitute for the MARQUEE tag in Netscape 6. You have to program the effect by yourself, using the DOM. We covered the DOM in Columns 40, The DOM, Part I: Analysis, through 47, A DOM-Based Snakes Game, Part II. For principles of animation, look for Column 18, JavaScript Animation, Part I, and JavaScript Animation, Part II.

Netscape 6 does not support the BGSOUND tag. Instead use the HTML3.2 EMBED, or the HTML 4.0 OBJECT tags. Also, Netscape 6 does not support Internet Explorer's document.styleSheet().addRule which sets Cascaded Style Sheet property from JavaScript.

In summary, when you start a new development now, avoid using:

Next: A Final Word

http://www.internet.com


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: December 4, 2000
Revised: December 4, 2000

URL: http://www.webreference.com/js/column72/6.html