afaolek
afaolek

Reputation: 8811

Difference between application/javascript and text/javascript

I was reading a tutorial on HTML 5 Canvas Animation with javascript (of course). In the header, the author used
application/javascript which is rather new to me because I've only seen text/javascript used. Can anyone help? There is every likelihood this question has been asked before but I'm using a phone to do this so I can't see any similar questions.

Thanks

Upvotes: 2

Views: 2046

Answers (2)

Andreas Wong
Andreas Wong

Reputation: 60526

  • text/javascript - is obsolete
  • application/javascript - MIME type for JS

Guidelines:

  • Use application/javascript on the server to return MIME type
  • Use text/javascript for type attributes of <script> tag although it's not really required

Upvotes: 2

Adam Hopkinson
Adam Hopkinson

Reputation: 28795

application/javascript is the correct MIME type for Javascript, although text/javascript shouldn't cause any issues

Upvotes: 2

Related Questions