Do HTML5 Script tag need type=”javascript”? [duplicate]

No, it’s now officially useless.

The type attribute gives the language of the script or format of the
data. If the attribute is present, its value must be a valid MIME
type. The charset parameter must not be specified. The default, which
is used if the attribute is absent, is “text/javascript”.

Simply do

<script src=yourpath.js></script>

(yes, you can omit the quotes too)

Note that you don’t have to worry about pre-HTML5 browsers, all of them always considered JavaScript to be the default script language.

Leave a Comment