The whole question fits in the title. And to add some context: I'm not asking what is the best according to what the specs are saying, but rather what works the best given the mix of browsers deployed nowadays.
Some data points:
text/javascript
for the JS used on their home page.text/javascript
on Google Docs.application/x-javascript
to serve JavaScript files with their Ajax libraries service.application/x-javascript
to serve their JS.application/x-javascript
for the JavaScript served on their home page.text/javascript
is obsoleteapplication/x-javascript
was experimental while deciding to move to…application/javascript
is the current official MIME type for JSThat said, browsers often ignore the content-type
sent by the server and pay a lot of attention to the type
attribute (and some may not yet recognise application/javascript
).
My recommendation:
type
attribute from script elementsNB: the HTML specification contradicts the MIME standard, and there is an effort to change it back to text/javascript
so this may change in future.