Server Fault is a question and answer site for system and network administrators. 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

Would there be any functionality/serving problems on an Apache2 by changing the following default MIME types...

.js  : application/x-javascript
.xml : application/xml

To this...

.js  : text/javascript
.xml : text/xml

My testing seems to show it will work, but I don't fully understand the purpose of MIME types as they relate to serving files.

share|improve this question
up vote 1 down vote accepted

You need to be careful with mime types as they're sent to the browser to help them interpret what way to render certain files.

Changing these two particular MIME types shouldn't hurt, but I'd be very wary of doing this in general. The mime type is sent with the headers for that particular file and changing those may result in unexpected behaviour with certain clients.

i.e. you can't really tell what will happen by changing mime types as such, as that's client specific. You'd need someone with experience of all the various web browsers to tell you in this case, or you'd need to go test it yourself. In general, that's what you'd need to be careful of.

share|improve this answer
Thanks Phil. I began investigating this because of the way Google hosts their jQuery.js file. If you look at their headers, they use text/javascript instead of application/x-javascript. I assumed, based on that information, that it would probably be okay. – Jeff Dec 9 '09 at 13:19
Oops. Here is the link to Googles' jQuery: . Check the headers. – Jeff Dec 9 '09 at 13:20

text/xml can be a problem. Some caching proxies will rewrite the character encoding of text/* files. In the case of an XML file, this could make the actual character encoding differ from the character encoding declared within the document itself. And besides, I think text/xml has been deprecated.

So always use application/xml for generic XML documents, and application/*+xml for specific documents which have their own registered MIME types (application/xul+xml for XUL, for example).

The only correct media type for javascript is application/javascript (or application/ecmascript, which is more strictly defined).

That said, many browsers won't care if you serve javascript as text/plain or even make something up altogether.

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.