Test Code Snippet One:
<! DOCTYPE html>
Intentionally linked to the wall, the test results are as follows:
1. The 6th row blocks the 7th line, (the link tag placed before the script will block script and will not block if link is placed after the script)
2. The IMG tag in the body blocks the Window.onload event.
3. The IMG tag in the body does not block the DOM ready event.
Two. Test Code Snippet 2.
<! DOCTYPE html>
1. The IMG tag in the body does not block the script behind the IMG tag
2. The DOM ready event ignores the IMG tag, and when the page opens the console will print out ready 1 and Ready 2 Ready 3 ready 4!
The output of code snippet two is as follows:
Dom is ready.
Onload.html:28 ready 1.
Onload.html:29 ready 2.
Onload.html:30 Ready 3.
Onload.html:39 Ready 4.
onload.html:37 GET https://www.twitter.com/test.jpg Net::err_connection_timed_out
onload.html:25 window onload.
Window.onload and Dom ready test