Browsers have for many years assumed that the script will be JavaScript unless the type attribute says otherwise. The HTML5 project makes this explicit.
Note that using XML-style self-closing tags:
- OK in XHTML 1.0 / 1.1 (but leave the type attribute disabled)
- NOT OK in HTML compliant XHTML 1.0 (which you need to use if you want IE8 and below to work)
- NOT OK in HTML 4.01
- NOT OK in HTML5
If you are writing HTML 4.01 (which is a reasonable idea for most sites, as it has mature QA tools), then you should write:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"> </script>
If you are writing XHTML 1.0 and jumping through the hoops necessary to deliver it to Internet Explorer 8 and below, you should use the same syntax for script elements as HTML 4.01.
If you are writing HTML5, you can omit the type attribute, but an explicit end tag is still required.
source share