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.