HTML Script tag: type or language (or omit both)?

前端 未结 3 1091
天涯浪人
天涯浪人 2020-11-22 11:20

vs.



        
3条回答
  •  悲哀的现实
    2020-11-22 12:05

    The type attribute is used to define the MIME type within the HTML document. Depending on what DOCTYPE you use, the type value is required in order to validate the HTML document.

    The language attribute lets the browser know what language you are using (Javascript vs. VBScript) but is not necessarily essential and, IIRC, has been deprecated.

提交回复
热议问题