javascript - type=text/javascript 和 language=javascript 之间的区别

标签 javascript jquery types connection

基本上就是这个问题。这两个语句之间的区别是什么:

语言

<script language="javascript" src="_js/calendar/calendar.js"></script>

文本/javascript

<script type="text/javascript" src="_js/calendar/calendar.js"></script>

最佳答案

根据 HTML 4.01 Spec :

type: This attribute specifies the scripting language of the element's contents and overrides the default scripting language. The scripting language is specified as a content type (e.g., "text/javascript"). Authors must supply a value for this attribute. There is no default value for this attribute.

language: Deprecated. This attribute specifies the scripting language of the contents of this element. Its value is an identifier for the language, but since these identifiers are not standard, this attribute has been deprecated in favor of type.

语言通常用于指示您的脚本需要的 Javascript 版本。支持语言属性的浏览器如果不支持则不会加载或运行脚本。唯一的用途是如果你有关键的 Javascript 功能,你需要针对旧浏览器的解决方法。

关于javascript - type=text/javascript 和 language=javascript 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12276803/

相关文章:

javascript - javascript 动态内容对于脚本小子来说是否足够安全?

javascript - 如何让 css 过渡在滚动到特定 div 之前不开始

C 和 libgcrypt。 Str 输入 gcry_error_t。然后加

javascript - 如何在完成多个异步调用后推迟 Backbone 中的调用?

javascript - 定义函数的差异 : JavaScript

javascript - 在 Javascript 中抛出自定义异常。使用哪种风格?

jquery - 通过 JQuery 添加动画背景后,链接和按钮不接受输入

使用 Ajax 的 Javascript POST 到 Django 不起作用

c# - 动态设置泛型类型参数

postgresql - PL/pgSQL : General Way to Update N Columns in Trigger?