Read this Code:
<Body> <script src = "deffer. js"> </script> content </body>
The content of deffer. js is:
Alert (1)
In this way, the page will be blank before the alert window is closed. The alert window stops page rendering.
To avoid such problems, the deffer and async attributes are defined in the html specification. The specific definitions of these two attributes are not discussed here. They are used to tell the browser, you must execute the content of this script after page rendering is complete, so that the page has been rendered when the script is executed.
<Body> <script deffer async src = "deffer. js"> </script> content </body>
Note: For multiple scripts with deffer or async, their execution order is irrelevant to the order in which they appear on the page. Even if the html Specification defines that the deffer script should be executed in order, the browser does not fully comply with this Convention.