High-performance JavaScript reading notes-1

Source: Internet
Author: User

Chapter I.

Load and Execute

When a browser executes JavaScript code, it cannot do anything else at the same time (a single process), which means that every time the <script> tag appears, the page is arbitrarily parsed and executed with scripts (each file must wait until the previous file has been downloaded and executed before the download is started). So the head of the JS and CSS to render the page, interactive behavior (almost all) JS on the <body> bottom;

The script tag is placed at the bottom of the page before the </body> closes, ensuring that the page finishes rendering before it executes


Reduce the number of external chain scripts will improve performance (merge JS)


Any web site can use a URL that merges the file to be processed to get any number of files.

can use a variety of non-blocking download JS method


Defer property can delay script (only IE4 and FF3.5 support)

Dynamically create script to download and execute

Use the Xhr object to download the JS code and inject the page

High-performance JavaScript reading notes-1

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.