spacer

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

home / experts / javascript / column26


Specifying the JavaScript Version

Developer News
Google Going Native With Chrome
Mozilla Fixes Firefox Flaws as 3.5 Release Nears
Microsoft and Novell Still Bosom Buddies

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, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
XML and PHP Simplified · Creating a ASP.NET Contact Form · Data Filtering with PHP
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Intel to Host Live Nehalem Q&A · 12 Tips to Troubleshoot Network File-Sharing · 10 Tips for Selling on Kijiji


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

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