[英]Conflicting of standards about the MIME type for javascripts?
RFC4329 and IANA says it's application/javascript
, and text/javascript
is obsolete. RFC4329和IANA说它是
application/javascript
,而text/javascript
已经过时了。 However, HTML standard (by WHATWG ) says servers should use text/javascript
rather than other obsolete types. 但是,HTML标准(由WHATWG表示)服务器应该使用
text/javascript
而不是其他过时的类型。
Why is there such a difference? 为什么会有这样的差异? What is the correct MIME type we should use for javascripts?
我们应该为javascripts使用什么正确的MIME类型? Does it mean that web servers should use
text/javascript
for scripts meant to be run by the browsers and use application/javascript
in other cases (eg for a js file to be downloaded)? 这是否意味着Web服务器应该使用
text/javascript
来表示由浏览器运行的脚本,并在其他情况下使用application/javascript
(例如,要下载js文件)?
In most real-world cases there is no difference. 在大多数现实世界中,没有区别。
One difference with any text/*
mimetype vs. application/*
mimetypes is that implementations may automatically convert the character encoding depending on the Accept-Charset
header without knowing anything else about the text format. 与任何
text/*
mimetype与application/*
mimetypes的一个区别是,实现可以根据Accept-Charset
头自动转换字符编码,而不知道有关文本格式的任何其他内容。
I haven't seen many real world cases where this happens. 我没有看到很多真实世界的情况。 I believe that most places now use
text/javascript
. 我相信现在大多数地方都使用
text/javascript
。 I assume that this is the case because application/javascript
simply hasn't caught on that much. 我认为是这种情况,因为
application/javascript
根本就没有那么多。
There's a lot of conjecture here without sources, so take it with a grain of salt. 这里有很多没有消息来源的猜想,所以要带上一粒盐。 I hope it's helpful.
我希望它有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.