Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
You're missing a closing ". – Hello71 Jul 20 '10 at 20:17
@Hello71 Good observation no wonder W3 Validation always complains at my mark-up ;-) – Metalshark Jul 20 '10 at 20:19
up vote 4 down vote accepted

The correct Content-Type is application/javascript

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

share|improve this answer
application/javascript it is - with text/javascript in the mark-up sigh – Metalshark Jul 20 '10 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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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