What is the difference between text / javascript and text / x-javascript? [duplicate]

1

Content-Type: application / x-javascript and Content-Type: application / javascript

    
asked by anonymous 01.11.2017 / 14:35

1 answer

3
  • text/javascript is deprecated
  • application/x-javascript was experimental, and they decided to officially change to the hitherto official application/javascript
  • application/javascript is the official MIME Type for JavaScript

Browsers often ignore the " content type " sent by the server and pay close attention to the type attribute (and some still do not recognize application/javascript , as in previous versions IE 8).

In most situations, the MIME Type that the server sends makes no practical difference. However, RFC 4329 recommends choosing application/javascript :

  

[...] The media types ,

* application/javascript
* application/ecmascript
     

    and should be used instead.

What a free translation would be:

  

[...] Media types ,

* application/javascript
* application/ecmascript
     

which are also defined in this document are intended for common use     and should be used instead.

We also have a question answered about this in our Big Brother SO .

    
01.11.2017 / 14:39