Defering javascript - what is the correct html syntax defer or defer=“defer”

前端 未结 4 711
别跟我提以往
别跟我提以往 2020-12-21 03:10

What is the correct syntax for using the defer attribute in your javascript?

I have seen it done two ways:

1:



        
4条回答
  •  情话喂你
    2020-12-21 03:18

    The async and defer attributes are boolean attributes that indicate how the script should be executed. The defer and async attributes must not be specified if the src attribute is not present.

    https://www.w3.org/TR/html5/scripting-1.html#attr-script-defer

提交回复
热议问题