Re: Missing attribute in a <script> element (Was: Re: [VE][127] Add Subject Here)

Sierk Bornemann wrote:

> Am 13.06.2008 um 08:35 schrieb Jukka K. Korpela:
>
>> According to RFC 4329 ( http://www.faqs.org/rfcs/rfc4329.html ), that
>> value is obsolete; in reality, the preferred "application/javascript"
>> may have more limited browser support.
>
> Only Internet Explorer and some older browsers lack the support for
> the mimetypes "application/javascript" and "application/ecmascript".

Thus, for the vast majority browsing situations, browsers do not support 
those inventions. IE is still the dominant browser, whether we like this 
or not. My statement "may have more limited browser support" is actually 
my candidate for nomination as the understatement of the year.

Even IE 7 does not recognize them. If you use

<script type="application/javascript" ...>...</script>

then IE simply ignores the entire <script> element, since it treats its 
language as unknown. This does not happen if you simply omit the 
type="..." attribute, so in a sense, the validator's message (though 
quite correct of course) can actually make things worse.

If you use the type="..." attribute (as you should by the DTD, but 
browsers don't really care if you omit it), use a value that is 
recognized by relevant software. On the web, "text/javascript" is the 
only sensible option, for now and for a few years at least.

Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/ 

Received on Friday, 13 June 2008 10:02:57 UTC