Mobile app version of vmapp.org
Login or Join
Reiling115

: What MIME type are you meant to use for JavaScript files? In the html we always use <script type="text/javascript" charset="utf-8" src="???"></script> (the ECMA stuff confuses some browsers)

@Reiling115

Posted in: #Http #Javascript

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.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Reiling115

2 Comments

Sorted by latest first Latest Oldest Best

 

@Kimberly868

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

10% popularity Vote Up Vote Down


 

@Dunderdale272

The correct Content-Type is application/javascript

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme