At my previous job a team leader was a firm believer that <script> tag must be always written in a full form like:
<script type="text/javascript">
When you have lots of javascript pieces, it becomes exhausting.
Good news, there is a way to tell to browser, that default script language is JavaScript.
To do that, inlcude a special META-tag in the HEAD of your HTML document. So if you have an inline JavaScript code for a onclick attribute of a tag, browser has no doubts it’s JavaScript.
Anyway, I include these lines in my projects HTML:
<meta http-equiv="Content-Script-Type" content="text/javascript" />
After that you can have just this:
<script>
By the way, since it’s http-equiv stuff, you can set it at server side.
P.S. There is the same trick for CSS, but it’s seems there are no alternatives to write styles, so it is useless.
December 8th, 2011 at 16:34
Nice trick. Didn’t know.
What browsers does it works with? Versions?