Answer the question
In order to leave comments, you need to log in
Is it possible to use the defer attribute instead of window.onload?
Reading on htmlbook
"The defer attribute delays script execution until the entire page has been loaded." <script defer>...</script>
Are we talking about loading the page structure or all the content in general?
Answer the question
In order to leave comments, you need to log in
The htmlbook article is not entirely correct. Here is some more description.
There are three possible modes that can be selected using these attributes. If the async attribute is present, then the script will be executed asynchronously, as soon as it is available. If the async attribute is not present but the defer attribute is present, then the script is executed when the page has finished parsing. If neither attribute is present, then the script is fetched and executed immediately, before the user agent continues parsing the page.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question