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”

defer=“defer”和async=“async”

PHP中文网
PHP中文网Original
2017-07-07 18:10:371005browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn