Script Tag - async & defer

前端 未结 8 1666
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 13:52

I have a couple of questions about the attributes async & defer for the

8条回答
  •  迷失自我
    2020-11-22 14:02

    async and defer will download the file during HTML parsing. Both will not interrupt the parser.

    • The script with async attribute will be executed once it is downloaded. While the script with defer attribute will be executed after completing the DOM parsing.

    • The scripts loaded with async does n't guarantee any order. While the scripts loaded with defer attribute maintains the order in which they appear on the DOM.

    Use

提交回复
热议问题