Stop Using type="text/javascript"
Sep0109Sep 01, 09
I don't know where this came from. It's so much like the old "language" attribute developers used to sneak into their <script> tags for no real reason. Stop and think about what you are typing. Assuming the "type" attribute was specifying a Content-type for the script - what else could it be - is "text/javascript" a valid mimetype? Of course not. The mimetype for JavaScript is application/x-javascript, as is assigned to served .js files by Apache. So why don't people start using something like this?
<script type="application/x-javascript">
Because that doesn't work in Internet Explorer. Internet Explorer only parses the JavaScript if it sees type="text/javascript" or no type attribute at all. Since all the other browsers support script tags without the type attribute, why on earth are people using it?
I think it's like something of a convention. I can remember a very long time ago when I used to work with ASP and Internet Explorer for development, the type attribute seemed appropriate - but that's when developers still thought things like VBScript had any purpose on the client side of things. It's been many years since those days and JavaScript is the only scripting language that can be run using the script element, so the pointless type attribute needs to be eliminated. The web development community has done a pretty good job of abolishing the language attribute for script tags, so let's all kill the type attribute while we're at it.
If you're still not convinced that you should drop the type from your script tags, here's a set of four JavaScript videos by Douglas Crockford. In one of the videos, he sets the record straight and questions the purpose of this attribute.

