Based on the question jQuery code not working in IE, text/javascript
is used in HTML documents so Internet Explorer can understand it.
But I’m wondering, when would you use application/javascript
, and more importantly, why would you use it instead of text/javascript
?
This question is related to
javascript
mime-types
application
because .js
-Files aren't something a user wants to read but something that should get executed.
application/javascript is the correct type to use but since it's not supported by IE6-8 you're going to be stuck with text/javascript. If you don't care about validity (HTML5 excluded) then just don't specify a type.
The problem with Javascript's MIME type is that there hasn't been a standard for years. Now we've got application/javascript as an official MIME type.
But actually, the MIME type doesn't matter at all, as the browser can determine the type itself. That's why the HTML5 specs state that the type="text/javascript"
is no longer required.
Source: Stackoverflow.com