开发者

why is jQTouch served as application/x-javascript

开发者 https://www.devze.com 2023-01-24 12:43 出处:网络
I\'ve always wondered why any jQTouch开发者_运维技巧 files are served with the mime type \"application/x-javascript\" as opposed to \"text/javascript\". Is there a particular reason for this I wonder,

I've always wondered why any jQTouch开发者_运维技巧 files are served with the mime type "application/x-javascript" as opposed to "text/javascript". Is there a particular reason for this I wonder, or is it just for accuracy's sake?


This seems to clear the confusion:

  • Javascript MIME type

There has always been confusion on the official MIME type of javascript. While servers mostly seem to use the following Apache rule: AddType application/x-javascript *.js authors claim it is text/javascript* in the TYPE attribute of the SCRIPT element (if they declare it). That has multiple reasons. First of all, the HTML specification suggests text/javascript and application/x-javascript is not supported by Internet Explorer. Note that IE does not support it only if it is the value of the TYPE attribute, what the server sends does not seem to matter.

And it gets even better. While the HTML camp is happily referring to their .js served as application/x-javascript using text/javascript as value for the TYPE attribute SVG people are using text/ecmascript. And again, this is because the SVG specification suggests it.

Perhaps, in the near future this will all be over when the draft of Scripting Media Types (01) becomes a RFC. Eventually it will specify two media types. (Currently it lists four.) One for javascript and one for ECMAScript. From a theoretical point of view I hope application/javascript and application/ecmascript will survive to the end. However, text/javascript and text/ecmascript are probably more useful with regard to current implementations and specifications.

0

精彩评论

暂无评论...
验证码 换一张
取 消