脚本标记的type属性的JavaScript MIME类型是什么?[重复]

Krinkledefrex提出了一个问题:What is the javascript MIME type for the type attribute of a script tag? [duplicate],或许与您遇到的问题类似。

回答者David Braunkeparo给出了该问题的处理方式:

This is a common mistake. The MIME type for javascript wasn't standardized for years. It's now officially: "application/javascript".

The real kicker here is that most browsers won't use that attribute anyway, at least not in the case of the script tag. They actually peek inside the packet and determine the type for themselves.

So the bottom line is that the type="text/javascript" doesn't do anything as far as the javascript is concerned, but it's part of the spec for both HTML 4 and XHTML 1.0.

希望本文对你有帮助,欢迎支持JavaScript中文网

原文链接:stackoverflow.com

上一篇:custom-guider
下一篇:流星javascript框架是如何工作的?[关闭]

公众号

欢迎 JavaScript 爱好者