Question

It has been stated that in HTML 5 it's OK to use script-tags for Javascript without any attributes, like this:

<script>
  // the javascript here
</script>

With other features in HTML 5 you can use different kind of poly-fills to bridge what old browsers don't know about HTML 5, but can above script-tag have any side-effect in any old browser?

UPDATE: Let's set the limit at IE6 and above, along with Firefox 2 and above, to have something concrete.

Was it helpful?

Solution

This is fine everywhere - the default value for type is the one you'd type anyway, as interpreted by browsers. I've used this on every site I've ever made and have never had problems. The same goes for script - no point specifying default values.

The HTML4 spec (http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1) says the type is required, though browsers are used to this being malformed (language being specified with no type, application/javascript instead of type/javascript etc. In short, browsers are used to this being wrong, so they look for script, and don't even parse the attributes as far as I can tell.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top