spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column26


Specifying the JavaScript Version

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

You can use the LANGUAGE attribute of the SCRIPT tag to specify the version of JavaScript that the script complies with. In fact, we use it all the time to distinguish between different versions of JavaScript. The line <SCRIPT LANGUAGE="JavaScript1.2"> directs the browser to interpret the script only if the version of JavaScript is 1.2 and to ignore the script if the version is higher than 1.2. Specify the JavaScript version if your script includes features that are not supported by other versions.

The default behavior for Netscape Navigator is to support the latest version of JavaScript that is supported by the browser. The latest version of JavaScript supported by Navigator 4.06 and 4.5 is 1.3. Therefore, the line <SCRIPT> is equivalent to <SCRIPT LANGUAGE="JavaScript1.3"> for these versions of Navigator.

To be html compliant (validator.w3.org) which we are switching over to, you need to add TYPE="text/javascript" to the script tag. So, the line

<SCRIPT LANGUAGE="JavaScript1.2">

becomes:

<SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">

The following table reviews the history of JavaScript tags and identifies the browsers that supported them

Navigator VersionExecutes Code WithinIgnores Code Within
Earlier than 2.0No support for JavaScriptNo Support for JavaScript
2.0LANGUAGE="JavaScript"LANGUAGE="JavaScript1.1"
LANGUAGE="JavaScript1.2"
LANGUAGE="JavaScript1.3"
3.0LANGUAGE="JavaScript"
LANGUAGE="JavaScript1.1"
LANGUAGE="JavaScript1.2"
LANGUAGE="JavaScript1.3"
4.0-4.05LANGUAGE="JavaScript"
LANGUAGE="JavaScript1.1"
LANGUAGE="JavaScript1.2"
LANGUAGE="JavaScript1.3"
4.06-4.5LANGUAGE="JavaScript"
LANGUAGE="JavaScript1.1"
LANGUAGE="JavaScript1.2"
LANGUAGE="JavaScript1.3"
No Tags are ignored

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Created: September 28, 1998
Revised: September 28, 1998

URL: http://www.webreference.com/js/column26/version.html