Browser Compatibility 385
JavaScript
Browser Compatibility
Web Design in a Nutshell, eMatter Edition
This code changes the image fromhome_off.giftohome_on.gifwhen the mouse is
placed over the graphic, but Netscape 1.0 and 2.0 and IE 1, 2 and 3 don’t under-
stand this code. Fortunately, anifstatement can be placed right in the anchor tag
so the JavaScript will only be used by appropriate browsers. Replace the bold lines
in the above code with these lines:
<A HREF=home.html onMouseOver="if (br=='n3') document.home.
src='home_on.gif';">
<IMG BORDER=0 HEIGHT=35 WIDTH=111 NAME="home" SRC="home_off.
gif"></A>
Here the mouseover effect is conditional on the browser being Netscape 3 or IE 4
or higher.
Browser Compatibility
As noted earlier, varying levels of JavaScript support have been built into browsers
since Netscape 2.0. The following table, by Nick Heinle, shows which browsers
support which JavaScript objects. For an online version of the table, seehttp://
webcoder.com/reference/2/index.html.
JavaScript Features Nav 2 Nav 3 Nav 4 IE 3 IE 4
Applets No Yes Yes Yes^1
(^1) Allows access to ActiveX too, but no Java API calls.
Yes^1
Areas No Yes Yes No Yes
Array No Yes Yes Yes Yes
CSS No No Yes^2
(^2) Navigator only allows predisplay control, except with positioning.
No Yes
Cookie Yes Yes Yes Yes^3 Yes
Date Yes Yes Yes Yes Yes
Event No No Yes^4 No Yes^4
External scripts No Yes Yes No^5 Yes
Forms Yes^6 Yes Yes Yes3,6 Yes
Frames Yes Yes Yes Yes Yes
History Yes Yes Yes Yes^3 Yes
Images No Yes Yes No^7 Yes
JavaEnabled No Yes Yes No Yes
Links Yes Yes Yes Yes Yes
Location Yes^8 Yes Yes Yes3,8 Yes
Math Yes Yes Yes Yes Yes
Navigator Yes Yes Yes Yes Yes
MimeTypes No Yes Yes No No
Options No Yes Yes No No
String Yes Yes Yes Yes Yes
Window Yes9,10 Yes^10 Yes Yes3,9,10 Yes^10
Write Yes^3 Yes^3 Yes Yes Yes