text/javascript
is obsolete, and application/x-javascript
was experimental (hence the x-
prefix) for a transitional period until application/javascript
could be standardised.
(text/javascript
已经过时, application/x-javascript
是实验性的(因此是x-
前缀),用于过渡期,直到application/javascript
可以标准化。)
You should use application/javascript
.
(你应该使用application/javascript
。)
This is documented in the RFC .(这在RFC中有记录 。)
As far a browsers are concerned, there is no difference (at least in HTTP headers).
(就浏览器而言,没有区别(至少在HTTP标头中)。)
This was just a change so that the text/*
and application/*
MIME type groups had a consistent meaning where possible.(这只是一个更改,因此text/*
和application/*
MIME类型组在可能的情况下具有一致的含义。)
( text/*
MIME types are intended for human readable content, JavaScript is not designed to directly convey meaning to humans).(( text/*
MIME类型用于人类可读的内容,JavaScript不是为了直接向人类传达意义)。)
Note that using application/javascript
in the type
attribute of a script element will cause the script to be ignored (as being in an unknown language) in some older browsers.
(请注意,在脚本元素的type
属性中使用application/javascript
将导致在某些旧版浏览器中忽略脚本(如未知语言)。)
Either continue to use text/javascript
there or omit the attribute entirely (which is permitted in HTML 5).(继续在那里使用text/javascript
或完全省略该属性(这在HTML 5中是允许的)。)
This isn't a problem in HTTP headers as browsers universally (as far as I'm aware) either ignore the HTTP content-type of scripts entirely, or are modern enough to recognise application/javascript
.
(这在HTTP标头中不是问题,因为普遍使用的浏览器(据我所知)要么完全忽略脚本的HTTP内容类型,要么现代化足以识别application/javascript
。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…