Window.onload and Dom ready test

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.