Download immediately, but delay execution. i.e. the script will be executed when the page has finished parsing. Note: The defer attribute only applies to external scripts, that is, when using the src attribute. Download immediately, but delay execution. i.e. the script will be executed when the page has finished parsing. Note: The defer attribute only applies to external scripts, that is, when using the src attribute.
Home > Article > Web Front-end > defer=“defer”和async=“async”
Download immediately, but delay execution. i.e. the script will be executed when the page has finished parsing.
Note: The defer attribute only applies to external scripts, that is, when using the src attribute.
Download immediately and execute asynchronously. There is no guarantee that they will be executed in the order in which they are specified.
Note: The defer attribute only applies to external scripts, that is, when using the src attribute.
The async attribute is new in HTML5.
If neither async nor defer is used: the script is read and executed immediately before the browser continues to parse the page.
The above is the detailed content of defer=“defer”和async=“async”. For more information, please follow other related articles on the PHP Chinese website!