Difference between app / javascript and text / javascript

I was reading the HTML 5 Canvas Animation tutorial with javascript (of course). In the title, the author used application/javascript

, which is pretty new to me, because I only saw text/javascript

. Can anyone please help? Chances are this question has been asked before, but I'm using a phone for this, so I don't see any similar questions.

thank

+3


source to share


3 answers


  • text / javascript - deprecated
  • application / javascript - MIME type for JS

Recommendation:



  • Use app / javascript on server to return MIME type
  • Use text / javascript for tag type attributes <script>

    , although it really isn't required
+2


source


application/javascript

is the correct MIME type for Javascript, although text/javascript

it shouldn't cause problems.



+2


source


text / javascript - deprecated application / javascript - current official MIME type for JS

However, browsers ignore the content type sent by the server and pay too much attention to the type attribute (and many still don't recognize the app / javascript).

Use application/javascript on the server
Use text/javascript as a hack in type attributes in HTML documents

      

+1


source







All Articles