1

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.

  1. text/javascript vs application/javascript ~ 5+ years old.
  2. When to use the JavaScript MIME type application/javascript instead of text/javascript? ~ 8+ years old.
  3. When serving JavaScript files, is it better to use the application/javascript or application/x-javascript - 10+ years old
  4. What is the javascript MIME type for the type attribute of a script tag? ~ 10+ years old.
Community
  • 1
  • 1
Sebin Benjamin
  • 1,758
  • 2
  • 21
  • 45
  • 2
    "This is NOT a duplicate of the following questions" — Yes, it is. You want to know what to use in the type attribute, and the spec says to omit it entirely, which is what the duplicate says. – Quentin Jul 03 '19 at 10:46
  • 2
    The question in your title is not the question in your text. The title asks what the correct MIME type is. The text asks what to put in the `script` element. As Quentin says, the correct thing for the `script` element is to leave `type` off entirely when the content is JavaScript. – T.J. Crowder Jul 03 '19 at 10:49
  • 2
    The question of what the correct MIME type is remains interesting. I'm fairly sure it's `text/javascript` now, and RFC 4329's vague "known to be problematic" is (13 years later) obsolete. But in pragmatic terms: `text/javascript` and `application/javascript` will be treated the same way by any reasonable consumer of MIME types. – T.J. Crowder Jul 03 '19 at 10:50
  • 1
    Re edit: It doesn't matter because it is such a mess now that everything is going to be compatible with everything forever. (That's an opinion. I don't think an answer to that could be anything but an opinion). – Quentin Jul 03 '19 at 10:52
  • Ok. So you are of the opinion that it might not make much difference even if the draft update proposal to RFC4329 expires (without being replaced by an updated version)? – Sebin Benjamin Jul 03 '19 at 11:05
  • Check out [IANA Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml) – phuzi Jul 03 '19 at 11:08
  • @phuzi That's because an RFC is by definition more formal and has a more permanent nature than Drafts. Until a new RFC is released, it can never be changed. If a revision becomes necessary, a new RFC is released that makes obsolete or extends the original document. Internet-Drafts should not be regarded as authoritative sources. – Sebin Benjamin Jul 03 '19 at 11:11
  • IANA Media Types and any other standards mostly refers to the current RFC, not the draft. – Sebin Benjamin Jul 03 '19 at 11:14

0 Answers0