Javascript mime types

Header Mime Types are one of the oldest ways for the web to communicate what type of media a file is (I would assume file extensions are the oldest way). Mime types are strings of meta-data sent when HTTP is communicating what the content type of a file being transmitted is. But, with this meta-data categorization there has been differences between browsers and servers regarding mime type strings and their association. This type of overlaying, now-a-days obviously duplicating, information is pretty standard for the older web ways of doing things, especially if they are still used in various forms in todays web world.

A decent example of this is javascript mime types. As listed below:

  • text/javascript
  • application/js
  • application/javascript
  • application/x-javascript

Overtime there has been duplication for various uses, but now are all still in standard use. So with something as common place as compression of javascript in gzip format for faster transmission over http, all listed mime types must be listed for the compression system to accurately compress all javascript files.

A list of all mime-media types are available on the IANA website.

If you have a comment or question, please respond below.