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

text/javascript vs application/javascript #27

Closed
saltbo opened this issue May 21, 2020 · 0 comments
Closed

text/javascript vs application/javascript #27

saltbo opened this issue May 21, 2020 · 0 comments
Labels
DAQ Daily asked questions

Comments

@saltbo
Copy link
Owner

saltbo commented May 21, 2020

问题描述

阿里云OSS针对js文件的gzip只对mime-type是application/javascript才有效。

在uptoc中使用了Golang的mime包,在本地测试时发现js对应的是application/javascript没有问题,但是在GitHubAction中却是text/javascript

问题排查

经过排查发现,在Golang 1.14版本中已经将application/javascript替换成了text/javascript,具体详见golang/go@99df76f#diff-bbab6cb33189f1aa348f52c5ad910da8

排查过程中受到一个回答的误导,见https://cloud.tencent.com/developer/ask/52563

里面有人说text/javascript 已过时,但实际情况是按照最新的HTML标准,即将废弃的是application/javascript,以后都应该使用text/javascript

结论

  • application/javascript是被废弃的
  • text/javascript是最新标准承认的
@saltbo saltbo added the DAQ Daily asked questions label May 21, 2020
@saltbo saltbo closed this as completed Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DAQ Daily asked questions
Projects
None yet
Development

No branches or pull requests

1 participant