Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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
add comment

2 Answers 2

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
add comment

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

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

share|improve this answer
add comment

Your Answer

 
discard

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.