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

Asked

Viewed 97 times

1

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

  • 1

    It could be an interesting question, it would be better if Oce could detail the doubt better and maybe because this difference can be a doubt/problem for Oce.

  • Uelsson, did any of the answers resolve what was in question? Do you need something better? Do you think it’s possible to accept any of them now? Your feedback is very important to the community. So content is more organized and easier to find in the future by other people with similar problems.

1 answer

3

  • text/javascript is obsolete
  • application/x-javascript was experimental, and decided to officially switch to the then official application/javascript
  • application/javascript is the MIME Type official for Javascript

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

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

[...] The media types,

* application/javascript
* application/ecmascript

which are also defined in this Document, are intended for common use and should be used Instead.

That in free translation would be:

[...] The types of media,

* application/javascript
* application/ecmascript

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

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

  • Storm, it is worth remembering although it is no longer so used, that application/javascript is not compatible for versions of IE older than 8.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.