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

Possible Duplicate:
Do you need text/javascript specified in your <script> tags?

Do in HTML5, the <script> tag need attribute type="text/javascript"?
I mean isn't it obvious if the <script> tag will be contains javascript?


Solution 1:

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.

Solution 2:

From the spec:

If the language is not that described by "text/javascript", then the type attribute must be present

And:

The default, which is used if the attribute is absent, is "text/javascript".

Conversely, that means that if your src attribute is for a file that is valid JavaScript, it is not needed.