Tips on delayed loading of JavaScript_javascript

Source: Internet
Author: User
When a website has a lot of js code to load, the js code placement location will, to a certain extent, reflect the loading speed of the webpage, in order to make our webpage load faster, this article summarizes several points of attention and shares with you that the delayed loading of JavaScript is one of the problems on the web that can drive you crazy about finding a solution.

Many people say "defer" or "async", and some even say "put your javascript code at the bottom of the page code ".

None of the above methods can solve the problem of loading external js after the web page is fully loaded. The above method occasionally prompts you to receive the "delay loading javascript" warning from the Google page speed testing tool. Therefore, the solution here will be a recommended solution from the Google help page.

How to delay loading JavaScript

The following code is recommended by Google. These codes should be placed inBefore the tag (close to the bottom of the HTML file ). In addition, I highlight the external JS file name.

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.