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?
The type attribute is required in HTML4. 01 but optional in HTML5. The type shows what type to be parsed. NOTE: if the type attribute is a audio, HTML, video, or any MIME type besides JavaScript the code will NOT be executed.
The type attribute in JavaScript is optional since the introduction of HTML5 brought some new improvements. JavaScript became the default language for HTML5 and modern browsers.
Dynamic script such as text/javascript . None, both the starting and ending tag are mandatory. Any element that accepts metadata content, or any element that accepts phrasing content.
text/javascript is the default type, so you can omit it, it makes no difference. Nothing, except in very special cases with old IE where if the first script element set the type to some other scripting language (e.g. VBScript) then that was the default if no type was specified.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With