Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Javascript validation question


12:33 pm on Jul 5, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 14, 2002
votes: 0

I use a remote service to gather statistics, and the HTML code they originally gave me was:

<script language="javascript" src="whatever">

That did not validate with transitional, so I added type=... to get:

<script type="text/javascript" language="javascript" src="whatever">

which validates fine in transitional but fails in strict.

The obvious solution is to go one step further and remove the offending language attribute. What worries me slightly is that the htmlhelp site says:

The required TYPE attribute of SCRIPT specifies the media type of the scripting language, e.g., text/javascript. However, most browsers only support the deprecated LANGUAGE attribute, which specifies the language name.

I suspect that much of htmlhelp is a little old, and I believe that I can safely discount that warning. The discussions on validating the Google AdSense code did not include any warnings about problems with browsers.

Still, I would be a lot happier if someone would confirm that most current browsers will work fine without the language attribute. If I fail to count five percent of my users it will be no big tragedy.

2:57 pm on July 5, 2003 (gmt 0)

Senior Member from MT 

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 1, 2003
votes: 0

also try addign a </script> afterwards.

Sometimes validation is NOT everything, I'm afraid...


7:02 pm on July 5, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
votes: 0

Most browsers seem to do just fine without EITHER attribute, although this is not valid HTML. I stopped using the language attribute two years ago, and have seen zero report of trouble.

Even though, according to the W3C, there is no standard default scripting engine for HTML, Microsoft's developer's site [msdn.microsoft.com] says:

In Internet Explorer, the default scripting engine is JScript.

...so that takes care of a big chunk of visitors. Since Netscape developed javascript, I'm assuming that Netscape defaults to javascript

Also, here's a W3C Reference [w3.org] which offers a few extra insurance steps you can take:

Authors should specify the default scripting language for all scripts in a document by including the following META declaration in the HEAD: <META http-equiv="Content-Script-Type" content="type"> ...where "type" is a content type naming the scripting language. Examples of values include "text/tcl", "text/javascript", "text/vbscript".

In the absence of a META declaration, the default can be set by a "Content-Script-Type" HTTP header. Content-Script-Type: type ...where "type" is again a content type naming the scripting language.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members