To prevent JavaScript from blocking page loading, we recommend using the HTML async attribute when loading JavaScript. For example:
<script async src="my.js">
If your JavaScript resources use document.write, it is not safe to use asynchronous loading. We recommend that scripts that use document.write be rewritten to use a different technique.
Additionally, when loading JavaScript asynchronously, if your page loads scripts that depend on one another, care must be taken to make sure that your application loads scripts in the proper dependency order.
If the external scripts are small, you can include them directly into the HTML document. Inlining small files in this way allows the browser to proceed with rendering the page.
If the external scripts are small, you can include them directly into the HTML document. Inlining small files in this way allows the browser to proceed with rendering the page.
Comments
Post a Comment