HTML Standard attribute: defer
[this page | pdf | back links]
The HTML defer attribute specifies that
JavaScript within (or refenced by) a <script>
should only be executed once the page has finished being parsed by the browser.
It only in practice applies to external scripts.
The async and defer attributes work in tandem as
follows:
-
If async is present then
the (external) script is executed asynchronously
with the rest of the page (with the script being executed while the page
continues to be parsed)
-
If async is not present but
defer is present then the (external)
script is executed when the page has finished parsing
-
If neither async or defer is present then the (external) script
is fetched and executed immediately, before further parsing of the page
Valid
attribute values
(when used with <script>
elements) include:
Value
|
Description
|
defer
|
Script should be
deferred until page has finished being parsed by the browser
|
NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes