You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2022/04/06 22:57:35 UTC

[Bug 65995] Change JavaScript MIME type from application/javascript to text/javascript

https://bz.apache.org/bugzilla/show_bug.cgi?id=65995

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> ---
(In reply to Alexander Veit from comment #0)
> Ref.:
> [1] https://datatracker.ietf.org/doc/draft-ietf-dispatch-javascript-mjs/17/
> [2] https://www.iana.org/assignments/media-types/media-types.xhtml#application

Some notes.

1. The IETF document [1] is a draft, but looking at its "History" [3] tab, it
has been approved.

> 2022-03-02 - IESG has approved the document
> 2022-03-02 - IESG state changed to Approved-announcement sent

The document is currently in a queue [4] to be published.

[3]
https://datatracker.ietf.org/doc/draft-ietf-dispatch-javascript-mjs/history/
[4]
https://www.rfc-editor.org/current_queue.php#draft-ietf-dispatch-javascript-mjs

2. The IETF Draft mentions (in "6.") that the HTML specification already uses
"text/javascript" as the default media type.

That essentially refers section "4.12.1.1 Processing model" of the HTML
Specification. [5]

[5]
https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model

3. Looking at the HTML specification, one can see the following text in section
"4.12.1.2 Scripting languages" [6]:

> Servers should use text/javascript for JavaScript resources.

[6] https://html.spec.whatwg.org/multipage/scripting.html#scriptingLanguages


4. The IETF Draft also mentions a new file extension ".mjs" is being
registered.


5. Apache Tomcat generally follows Apache HTTP Server in its mime-type
mappings.

One can see that the configuration file "conf/mime.types" in Apache HTTP Server
project has not been updated yet.

Both in the trunk version [7] (last updated in December 2020), and on the 2.4.x
branch [8] (last updated 4 years ago) as well.

[7] https://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/
[8] https://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/conf/


6. Personally, it is odd to me to read that "text/javascript" is more popular
than "application/javascript", despite RFC4329 [9] that suggested otherwise,
despite all popularity of Apache HTTP Server and "application/javascript" being
the default configuration.

My guess is that "text/javascript" is popular as a value of the type attribute
of <script> tag of HTML (not only thanks to HTML 5 specification, but the
previous HTML 4 as well [10]), but hardly anyone cares what Content-Type is
used when sending a js file over the wire.

[9] https://datatracker.ietf.org/doc/html/rfc4329
[10] https://www.w3.org/TR/html401/interact/scripts.html


Overall, I see that there are grounds to make the change. I would like to wait
for the official publication of the document by IETF, and RFC4329 [9] being
declared as obsolete.

Also it looks that we can add a mime-mapping for "mjs" to be "text/javascript"
at the same time.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org