In the html we always use <script type="text/javascript" charset="utf-8" src="???"></script> (the ECMA stuff confuses some browsers) but on the HTTP side what are you meant to use as the Content-Type?

By instinct this would also be text/javascript, but Apache uses application/javascript and Amazon uses application/x-javascript.

Some firewall admins block any MIME types matching application/*; but which MIME type are you meant to use from a webmaster perspective? What is the "right" thing to do.

  • You're missing a closing ".
    – Hello71
    Jul 20, 2010 at 20:17
  • @Hello71 Good observation no wonder W3 Validation always complains at my mark-up ;-)
    – Metalshark
    Jul 20, 2010 at 20:19

2 Answers 2


The correct Content-Type is application/javascript

See: What is the Javascript MIME Type? on Stack Overflow

  • application/javascript it is - with text/javascript in the mark-up sigh
    – Metalshark
    Jul 20, 2010 at 20:45

This page has a list of what's accepted by which browser, for example:

Opera 7.54+
IE 5+
Firefox 1.0.7+
Safari 2.0.3+
iCab 3 Beta 394
Camino 2006021400

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.