I am delivering a JS response from a PHP file. When setting the Content-Type header to use, application/javascript or text/javascript ?
Content-Type
application/javascript
text/javascript
What is the difference between the two?
According to the IANA Registered MIME media type list , JS has two registered MIME types; deprecated text/javascript and official application/javascript .
So use application/javascript .
From Wikipedia to Internet Media Types
application/javascript: JavaScript; Defined in RFC 4329 but not accepted in IE 8 or earlier
application/javascript:
There is also legacy text/javascript (which IE probably won't suffocate).