All of the following values for the <script type=" ••• ">
will cause inline or external JavaScript to execute:
Value | Note |
---|---|
"" |
The default value of script.type (eg: no type attribute present) |
"text/javascript" |
The official JavaScript MIME type |
"application/javascript" |
Legacy MIME type from when semantics mattered |
"text/x-javascript" |
Legacy MIME type from before JavaScript was accepted as a valid MIME type |
"application/x-javascript" |
Same as above, but more pedantic about MIME semantics |
" text/javascript " |
Arbitrary spaces are allowed, but only at the start/end (applies to all except "") |
"text/ecmascript" |
New legacy MIME type from before folks realized we wouldn't need a new one |
"application/ecmascript" |
Same as above, but 20y later still pedantic about semantics (consistency++) |
"text/x-ecmascript" |
Woah, maybe someone did realize we wouldn't need an ECMAScript MIME type? |
"application/x-ecmascript" |
Added by Gandalf |
... and then of course "module"
, which is just "module"
.