language (HTML attribute)
| Depr. | Version |
|---|---|
| Yes | N/A |
Example
In this example, a
script is identified as requiring JavaScript
1.2-capable browsers:
<script language="JavaScript1.2" src="/scripts/complex.js"></script>
Description
The
language attribute tells the browser which
scripting language is to be used inside the script
block (or in the file referred to by the src
attribute, as shown in the example). It may be the name of the scripting
language, or a version-specific implementation of the language (see the
values below).
Note that the language
attribute is nonstandard, and harks back to the days of what were known as
the “browser wars.” The appropriate way to identify the contents of the
script element is through the type attribute (for
example, you might specify the content as
"text/javascript"), and use JavaScript object/feature
detection techniques within the script rather than assume that all
browsers which support a given version of a scripting language support all
of the features of that language—no questions asked.
Value
The values that can be used in this attribute are:
"JavaScript","JavaScript1.1","JavaScript1.2","JavaScript1.3""JScript""VBScript""vbs"
Compatibility
Browser support is generally good, but you can’t rely on support for scripting language version numbers alone to decide whether to execute a piece of script or not.
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.
