What is the difference between “lang” and “type” attributes in a script tag?

后端 未结 7 1147
攒了一身酷
攒了一身酷 2020-12-05 15:54

For

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 16:16

    Per the 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.

提交回复
热议问题