GSAnet Banner Swap





to tricks page

Loading JavaScript version-sensitive document.

As you probably know, Netscape Navigator 2.0 is compatible with JavaScript 1.0 and newer Navigator 3.0 incorporates a more advanced JavaScript 1.1 and, finally, Netscape Communicator uses JavaScript 1.2. Sometimes you might want to have two versions of one page, so that a JavaScript 1.0 document version is loaded if user has a Navigator 2.0 (or MS Internet Explorer 3) and a JavaScript 1.1 version if user has a Navigator 3.0 (or MS IE4). This can be done by using LANGUAGE attribute of a SCRIPT tag.

<SCRIPT LANGUAGE="JavaScript1.1"> location.replace("my_js11.html") </SCRIPT>

<!-- JavaScript1.0 compatible document follows-->

Explanations:

If LANGUAGE attribute contains "JavaScript1.1", Navigator 2.0 (or any other browser that supports earlier JavaScript versions) ignores the SCRIPT tag completely, because Navigator 2.0 expects "JavaScript" value. But Navigator 3.0, which supports and recognises "JavaScript1.1" value executes the SCRIPT tag and will execute the location.replace command that will load my_js11.html.


©1997 repfect Drug design studio. All Rights Reserved.