I'm currently validating a page with multiple errors on it for doctype html 4.01 strict.

On the errors that I don't quite understand I place the single error in a shorter document and re-validate to make sure that none of the other errors are causing that problem.

Recently from the line:

    <script language="JavaScript" type="text/javascript" src="/script.js"></script>

...I received the error:

there is no attribute X
You have used the attribute named above in your document, but the

document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the

document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute,

(Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the element to incorporate flash media in a Web page, see the FAQ item on valid flash.

    * Line 6, column 19: Attribute "LANGUAGE" is not a valid attribute.

Did you mean "language"?

          <script language="JavaScript" type="text/javascript"> src="/script.js"></script>

When I remove the language attribute, it validates fine.

I normally develop using an xhtml strict doctype; and I was under the impression that leaving out the language attribute would cause the script not to work in certain versions of IE.

Is it true that leaving out the language attribute from a script tag would cause the script not to be executed in certain versions of IE or will it work with the html 4.01 strict doctype?

3 answers

Doug 1095
This was chosen as the best answer

I recommend leaving it out.

AFAIK, the only reasons to include the language attribute are to use a language other than JavaScript (language="VBscript") or to restrict an older browser from executing code it won't recognize. E.g., language="JavaScript1.5" will prevent execution in IE6, which only supports up to JavaScript1.3.

Answered over 8 years ago by Doug
  • Thanks. And may your score cover up your avatar image! Andrew J. Leer over 8 years ago

I'm not sure what version of IE would have issues without the IE-specific language attribute. If it's really required, perhaps adding a conditional comment with the script tag + language attribute would be better?

I don't use the language attribute on any of my sites, and IE 6 loads fine (as well as can be expected from IE 6, anyway).

Answered over 8 years ago by Nathan DeGruchy
danwellman 5600

The language attribute for script elements was deprecated some time ago in favour of the type attribute, which can be used to specify any script language. See this page for clarification.

Specifying the language attribute was used to prevent browsers that did not support a particular version of JavaScript from seeing scripts, as described here.

But there are other ways of making scripts work (or at least not completely fail) in IE6 that do not use deprecated attributes. I would avoid its use.

Answered over 8 years ago by danwellman