What is an appropriate content-type header for JavaScript files?
Solution 1:
According to the IANA Registered MIME media type list, JS has two registered MIME types; the obsolete text/javascript
and the now official application/javascript
.
Thus, use application/javascript
.
Solution 2:
From Wikipedia on Internet Media Types
application/javascript:
JavaScript; Defined in RFC 4329 but not accepted in IE 8 or earlier
There is also the deprecated text/javascript
(which IE will probably not choke on).