Usually, our website will load some js Code, statistics, google ads, Baidu consortium, alimama's ad code, and a bunch of code. In the end, it makes page loading slow and slow.
Solution: Use a js inclusion method to increase the loading speed of javascript.
Load the following methods:
Copy codeThe Code is as follows:
<Script src = "xxxx. js"> </script>
Changed:
Copy codeThe Code is as follows:
<Script type = "text/javascript">
Document. write ("<scr" + "ERT src =" xxx. js "> </SC" + "ript> ")
</Script>
To load multiple js files, use the following method:
Copy codeThe Code is as follows:
<Script type = "text/javascript">
Document. write ("<scr" + "ept src =" xxx1.js "> </SC" + "ript> ");
Document. write ("<scr" + "ept src =" xxx2.js "> </SC" + "ript> ");
Document. write ("<scr" + "ept src =" xxx3.js "> </SC" + "ript> ");
</Script>
Other js files, such as Ad files and special page effects...
Finally, let's talk a few nonsense words:
Use
Copy codeThe Code is as follows:
<Script type = "text/javascript">
Document. write ("<scr" + "ept src =" xxx. js "> </SC" + "ript> ")
</Script>
You can also load the JS file as required:
Copy codeThe Code is as follows:
<Script type = "text/javascript">
If (good mood) {document. write ("<scr" + "ERT src =" xxx. js "> </SC" + "ript> ")}
</Script>