這兩天使用iewatch觀察google的網(wǎng)站的時候,發(fā)現(xiàn)學(xué)到j(luò)s文件的mime類型為text/javascript,而今天在qq的網(wǎng)站上,使用iewatch發(fā)現(xiàn),有時用text/javascript的,也有使用application/javascript的還有使用appliation/x-javascript的,所有就不太知道這三個mime 類型有什么區(qū)別,在google上一搜:
The traditional MIME type for JavaScript programs is
"text/javascript". Another type that has been used is
"application/x-javascript" (the "x" prefix indicates that it is an
experimental, nonstandard type). RFC 4329 standardized the
"text/javascript" type because it is in common use. However, because
JavaScript programs are not really text documents, it marks this type
as obsolete and recommends "application/javascript" (without the "x-")
instead. At the time of this writing, "application/javascript" is not
well supported, however. That might be the reason why
"application/x-javascript" is used by a lot of webpages.
大致意思是:傳統(tǒng)的javascript程序的MIME類型是“text/javascript”,其他使用的還有"application/x-javascript"(x前綴表示這是實驗性的,不是標(biāo)準(zhǔn)的類型),RFC4329規(guī)定了“text/javascript”類型,因為它普遍被使用。然而,javascript程序并不是真正的文本文件,這就表示這個類型已經(jīng)意味著過時了,而推薦使用"application/javascript"(去除x前綴)。然而,在寫程序的時候,"application/javascript"沒有很好的支持。這也行就是"application/x-javascript"被使用在很多網(wǎng)頁中的原因。
作者:高級測試開發(fā)網(wǎng)
本文摘自 :https://blog.51cto.com/u