Skip to content

Conversation

@mgol
Copy link
Member

@mgol mgol commented Dec 1, 2025

The proper MIME type for JavaScript files is "text/javascript", not "application/javascript". Even though "application/javascript" is on the list of JavaScript MIME types:
https://mimesniff.spec.whatwg.org/#javascript-mime-type per:
https://html.spec.whatwg.org/multipage/scripting.html#scriptingLanguages

Servers should use text/javascript for JavaScript resources, in accordance
with Updates to ECMAScript Media Types. Servers should not use other
JavaScript MIME types for JavaScript resources

"Updates to ECMAScript Media Types" is the following RFC: https://www.rfc-editor.org/rfc/rfc9239

In section "2. Compatibility" it says:

The most widely supported media type in use is text/javascript; all others
are considered historical and obsolete aliases of text/javascript.

@mgol mgol self-assigned this Dec 1, 2025
The proper MIME type for JavaScript files is "text/javascript", not
"application/javascript". Even though "application/javascript" is on the list
of JavaScript MIME types:
https://mimesniff.spec.whatwg.org/#javascript-mime-type
per:
https://html.spec.whatwg.org/multipage/scripting.html#scriptingLanguages

> Servers should use text/javascript for JavaScript resources, in accordance
> with Updates to ECMAScript Media Types. Servers should not use other
> JavaScript MIME types for JavaScript resources

"Updates to ECMAScript Media Types" is the following RFC:
https://www.rfc-editor.org/rfc/rfc9239

In section "2. Compatibility" it says:
> The most widely supported media type in use is text/javascript; all others
> are considered historical and obsolete aliases of text/javascript.
@mgol mgol merged commit 3b5ee7f into jquery:main Dec 1, 2025
8 checks passed
@mgol mgol deleted the js-mime-type branch December 1, 2025 23:33
@mgol mgol removed the Needs review label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants