JavaScript Tip of the Week for November 4, 1996: But it Worked in Netscape? (or) JavaScript Compatability Issues | WebReference

JavaScript Tip of the Week for November 4, 1996: But it Worked in Netscape? (or) JavaScript Compatability Issues


JavaScript Tip of the Weekfor November 4, 1996: But it Worked in Netscape? (or) JavaScript Compatability Issues

For a long time I've had people asking me which scripts work on which browsers. This week I've decided to clear up that problem for good: I've compiled a list which contains explanations of which features work on which browsers. It will be updated for all the respective versions of Netscape and IE. I'm going to add to it often, and it may even become a feature of JTotW. If you find any specific features that vary signifigantly from browser to browser missing then please add them to the list.

This list is broken down by feature and then by browser. Each feature that signifigantly differs from browser to browser is explained briefly and then any quirks or discontinuities are explained. Note: Releases such as 3.01 or 2.02 are not considered different versions, but notes will be made about those changes. For now this list essentially appears to be a list of Netscape 3.0's features. This is because Netscape 3.0 differs greatly from Netscape 2.0 and Internet Explorer. Why? When Microsoft was developing their browser, Netscape 3.0 was still in beta, so IE is based on most of Netscape 2.0's JavaScript features. If something works in Netscape 2.0 it will most likely work in IE, with a few exceptions.

A Note to JTotW Readers:

One thing I would like to address about the tips: the small alpha-numeric signs (N3, N2, E3) denote which browsers the tips will work on. N3 stands for Netscape 3.0, E3 for Internet Explorer 3.0, etc. If the signs under a specific tip are highlighted, it means the tip will work on those browsers. Otherwise the tip will probably function improperly on that browser and version detection should be used.

The List, 4th Revision

Array [True Array Object]
What it does: Allows JavaScript to create, access, sort, and join arrays with the full functionality that Java enjoys. But, there is a pseudo-array object can be used on all browsers.
Related Tips: Random Quotes and Images [workaround, uses pseudo-array objects that work in Netscape 2.0]
Netscape 4.0 Assume it will be Supported
Netscape 3.0 Fully Supported
Netscape 2.0 Not Supported
MSIE 4.0 Assume it will be Supported
MSIE 3.0 Fully Supported

Cookie [Persistant Data]
What it does: Allows JavaScript save a small amounts of data on a user's machine to be accessed at a later time. Great for remembering names, passwords, and other bits of info that need to be stored over a long period of time. This does not give access to any part of the user's hard drive or local files.
Related Tips: Using a Browser's Cookie
Netscape 4.0 Assume it will be Supported
Netscape 3.0 Fully Supported
Netscape 2.0 Fully Supported
MSIE 4.0 Assume it will be Supported
MSIE 3.0 Fully Supported [Important: The cookie will not function properly locally or on your hard drive. It must first be put on your server.]

Dynamic Image Object
What it does: Allows JavaScript to change the source file of an image right on the page. Can be used to create highighted menus, animations, etc.
Related Tips: Highlighted Menus, JavaScript Billboard
Netscape 4.0 Assume it will be Supported
Netscape 3.0 Fully Supported
Netscape 2.0 Not Supported
MSIE 4.0 We'll find out...
MSIE 3.0 Not Supported

External Scripts [SRC]
What it does: Allows JavaScript code to be stored in an external document with the .js extension. Useful if the same functions need to be used repeatedly in a large site. Make sure to set your server's MIME type to "application/x-javascript" for the .js extension. Use this syntax: <SCRIPT SRC = "scripts.js">
Related Tips: Coming Soon...
Netscape 4.0 Assume it will be Supported
Netscape 3.0 Fully Supported
Netscape 2.0 Not Supported
MSIE 4.0 We'll find out...
MSIE 3.0 Not Supported

LiveConnect
What it does: Allows JavaScript to communicate with Java applets and LiveConnect enabled plug-ins such as LiveAudio. Also allows JavaScript to access Java's methods and classes and vice versa.
Related Tips: Much Ado about LiveConnect
Netscape 4.0 Assume it will be Supported
Netscape 3.0 Supported on all Java enabled platforms
Netscape 2.0 Not Supported
MSIE 4.0 We'll find out...
MSIE 3.0 Supported on all Java enabled platforms

Math.random()
What it does: Generates a random number (0 through 1) using system clock. This is not the best way to generate random numbers, but it will do for most purposes.
Related Tips: Random Quotes and Images [workaround, does not use Math.random()]
Netscape 4.0 Assume it will be Supported
Netscape 3.0 Fully Supported
Netscape 2.0 Not Supported
MSIE 4.0 Assume it will be Supported
MSIE 3.0 Fully Supported

Modifiable Select Objects
What it does: Allows JavaScript to add, delete, and modify the options in select [menu] objects and have those changed displayed directly on the page.
Related Tips: Modifiable Select Menus II
Netscape 4.0 Assume it will be Supported
Netscape 3.0 Fully Supported
Netscape 2.0 Not Supported
MSIE 4.0 We'll find out...
MSIE 3.0 Not Supported

Plug-In Detection
What it does: Allows JavaScript to detect which plugins are installed in the browser and then tailor the page accordingly.
Related Tips: Checking for Plugins and File Types
Netscape 4.0 Assume it will be Supported
Netscape 3.0 Fully Supported
Netscape 2.0 Not Supported
MSIE 4.0 We'll find out...
MSIE 3.0 Not Supported

Window Object
What it does: Allows JavaScript to create new browser window and modify its properties (such as location). Allows opened window to talk back to its opener window and allows for focusing and blurring of windows.
Related Tips: All About Windows, New Window Features in Netscape 3.0
Netscape 4.0 Assume it will be Supported
Netscape 3.0 Fully Supported
Netscape 2.0 Partially Supported [doesn't allow focus or blur]
MSIE 4.0 Assume it will be Supported
MSIE 3.0 Partially Supported [object model is slightly different, doesn't allow focus or blur]