Analysis of js latency Execution Problems

Source: Internet
Author: User

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.

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.