[html5] <script> tag "type" and backwards compatibility?
Micky Hulse
mickyhulse.lists at gmail.com
Wed Apr 27 13:54:30 PDT 2011
Hello,
Sorry in advance if this is a silly question...
Will "<script>" tag work in older browsers if I omit the "type" attribute?
In HTML4, the specs say:
type = content-type [CI]
This attribute specifies the scripting language of the element's
contents and overrides the default scripting language. The scripting
language is specified as a content type (e.g., "text/javascript").
Authors must supply a value for this attribute. There is no default
value for this attribute.
-- http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1
HTML5:
When used to include dynamic scripts, the scripts may either be
embedded inline or may be imported from an external file using the src
attribute. If the language is not that described by "text/javascript",
then the type attribute must be present, as described below. Whatever
language is used, the contents of the script element must conform with
the requirements of that language's specification.
-- http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#script
I assume that it would be safest for me to specify the content type
for the sake of older browsers?
Thanks!
Micky
More information about the Help
mailing list