[html5] <script> tag "type" and backwards compatibility?

Jukka K. Korpela jukka.k.korpela at kolumbus.fi
Wed Apr 27 14:01:32 PDT 2011


Micky Hulse wrote:

> Will "<script>" tag work in older browsers if I omit the "type"
> attribute?

Yes. They treat the content as (some flavor of) JavaScript by default. I 
don't think there's a single exception to this.

> I assume that it would be safest for me to specify the content type
> for the sake of older browsers?

I don't think it implies any safety. And there's a small risk in using it. 
If you mistype the content type name, e.g. type="text/javascirpt", browsers 
will ignore the script element's content without saying anything - they just 
treat it as written in an unknown language.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 




More information about the Help mailing list