type="application/javascript"

html script 标签中 type有如下这些值,请问分别是什么意思,在什么情况下使用?
  • type="text/javascript"
  • type="application/javascript"
  • type="application/x-javascript"
这3个有什么区别吗 ?
 
  1. The traditional MIME type forJavaScript 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.
 

大致意思是:传统的javascript程序的MIME类型是“text/javascript”,其他使用的还有"application/x-javascript"(x前缀表示这是实验性的,不是标准的类型),RFC4329规定了“text/javascript”类型,因为它普遍被使用。然而,javascript程序并不是真正的文本文件,这就表示这个类型已经意味着过时了,而推荐使用"application/javascript"(去除x前缀)。然而,在写程序的时候,"application/javascript"没有很好的支持。这也就是"application/x-javascript"不被使用在很多网页中的原因。

您是否很疑惑为什么我们没有在<script>标签中使用 type="text/javascript"?
 

在 HTML5 中,不必那样做了。JavaScript 是 HTML5 以及所有现代浏览器中的默认脚本语言!

最新文章

  1. 我的angularjs源码学习之旅2——依赖注入
  2. 用OMT方法建立其分析模型: 本大学基于网络的课程注册系统。
  3. SQL Server - select语句练习
  4. [Tango] Basic Knowledge
  5. Linux下的JDK安装rpm命令详解
  6. GC回收建议
  7. 速卖通---发布商品aeopAeProductPropertys这个字段值报07004013的错误
  8. OD: Exploit Me - Overwrite Nearby Varible
  9. Spring与Mybatis配置问题
  10. memcached vs MySQL Memory engine table 速度比较_XMPP Jabber即时通讯开发实践_百度空间
  11. Xamarin之 环境错误集锦
  12. MySQL中, 如何查询某一天, 某一月, 某一年的数据.
  13. Does the C standard guarantee buffers are not touched past their null terminator?
  14. Codeforces 757B. Bash&#39;s Big Day GCD
  15. 关于c#的知识博客
  16. poj 1776 Task Sequences
  17. mysql中explain
  18. springboot项目文件上传(绝对路径)并使用tomcat虚拟路径进行图片预览
  19. 手机防盗之获取手机经纬度(Android)
  20. 【LA2957 训练指南】运送超级计算机【二分,最大流】

热门文章

  1. MySQL 启动服务和登陆参数
  2. vue-cli 升级至 webpack 4 指北
  3. winMTR的使用
  4. [C++ STL] 常用算法总结
  5. linux学习之路5 系统常用命令
  6. Too many open files故障解决一例
  7. Intellij 下 mybatis 插件 MyBatisCodeHelperPro破解
  8. UIPickerView 多级联动
  9. JPQL 模糊查询,查询条件拼接(like使用)
  10. dubbo之服务容器