I need to know what could be the correct current/future proof Javascript MIME type.
References
RFC 4329- April 2006, seems to say text/javascript is obsolete and recommends to use application/javascript :
Use of the "text" top-level type for this kind of content is known to be problematic. This document thus defines text/javascript and text/ecmascript but marks them as "obsolete".
HTML Living Standard — Updated 2 July 2019 I guess says text/javascript is fine :
The term "JavaScript" is used to refer to ECMA-262, rather than the official term ECMAScript, since the term JavaScript is more widely known. Similarly, the MIME type used to refer to JavaScript in this specification is text/javascript, since that is the most commonly used type, despite it being an officially obsoleted type according to RFC 4329. [RFC4329]
So at this point text/javascript is correct?
Internet Draft - ECMAScript Media Types Updates to RFC4329, which is said to expire on December 21, 2019, says
This document updates the existing media types for the ECMAScript programming language. It supersedes the media types registrations in [RFC4329] for "application/javascript" and "text/javascript".
application/javascript - Intended usage: OBSOLETE
The first version of the same draft on October 7, 2017, also says
text/javascript has been moved intended usage from OBSOLETE to COMMON.
Also MDN - Incomplete list of MIME types mention JavaScript MIME type ad text/javascript
Question
Part 1. What would be the correct MIME type at present/after December 21, 2019, if the draft expires/does not expire?
Part 2. Should the drafts be followed before they are finalized?
PS :
This is NOT a duplicate of the following questions. I have gone through most of the main discussions in these questions.
- text/javascript vs application/javascript ~ 5+ years old.
- When to use the JavaScript MIME type application/javascript instead of text/javascript? ~ 8+ years old.
- When serving JavaScript files, is it better to use the application/javascript or application/x-javascript - 10+ years old
- What is the javascript MIME type for the type attribute of a script tag? ~ 10+ years old.
script
element. As Quentin says, the correct thing for thescript
element is to leavetype
off entirely when the content is JavaScript.text/javascript
now, and RFC 4329's vague "known to be problematic" is (13 years later) obsolete. But in pragmatic terms:text/javascript
andapplication/javascript
will be treated the same way by any reasonable consumer of MIME types.