spacer

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

home / experts / javascript / column26


Specifying the JavaScript Version

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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 >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


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

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