Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommend text/javascript as the media type for JavaScript resources #568

Closed
alrra opened this issue Oct 6, 2017 · 6 comments
Closed

Recommend text/javascript as the media type for JavaScript resources #568

alrra opened this issue Oct 6, 2017 · 6 comments

Comments

@alrra
Copy link
Contributor

alrra commented Oct 6, 2017

Servers should use text/javascript for JavaScript resources. Servers should not use other JavaScript MIME types for JavaScript resources, and must not use non-JavaScript MIME types.

Ref:

@alrra alrra self-assigned this Oct 6, 2017
@alrra alrra changed the title Recommend text/javascript as the media type for scripts Recommend text/javascript as the media type for scripts Oct 6, 2017
@alrra alrra changed the title Recommend text/javascript as the media type for scripts Recommend text/javascript as the media type for JavaScript resources Oct 6, 2017
@alrra alrra closed this as completed in f794bc8 Oct 6, 2017
@gemal
Copy link

gemal commented Oct 27, 2017

I dont think this change is correct

https://www.iana.org/assignments/media-types/application/javascript = OBSOLETE
https://www.iana.org/assignments/media-types/text/javascript = COMMON

@alrra
Copy link
Contributor Author

alrra commented Oct 27, 2017

@gemal Historically, text/javascript was recommended and used since the early days, so the chances of it breaking things is less than the recently IANA recommended application/javascript.

The HTML spec was also updated and recommends using text/javascript (and usually the spec tries to reflect the reality, not some ideal world).

See also: https://html.spec.whatwg.org/multipage/infrastructure.html#dependencies


Note: For current user agents it shouldn't matter that much which of the two you use, but with this project we try to recommend what is considered the best option.

Hope that clarifies things.

@alrra
Copy link
Contributor Author

alrra commented Oct 30, 2017

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".

From https://tools.ietf.org/html/draft-ietf-dispatch-javascript-mjs-00

@maple3142
Copy link

https://www.rfc-editor.org/rfc/rfc4329.txt
But this said text/javascript is obsolete

@alrra
Copy link
Contributor Author

alrra commented Nov 4, 2017

@maple3142 Please read the previous comments. Thanks!

@alrra
Copy link
Contributor Author

alrra commented Aug 20, 2018

See also: whatwg/mimesniff#76.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants