Usually our website will load some JS code, statistics ah, Google ads Ah, Baidu League ah, Ali mom Advertising code Ah,
A bunch, and finally make the page load slowly, very slow.
Workaround: Change the way JS is included to allow JavaScript to load exponentially.
Put the usual load mode:
<script src= "Xxxx.js" ></script>
Change into:
<script type= "Text/javascript" >document.write ("<SCR" + "IPT src=\" xxx.js\ "></sc" + "ript>") </ Script>
As an example:
For example, the following is the application of the webmaster Statistics code, although it was placed at the bottom of the page, but still drag the page load progress.
<script src= "Http://s69.cnzz.com/stat.php?id=265381&web_id=265381&show=pic" language= "JavaScript" charset= "gb2312" ></script>
We can put it in this way to load (still on the bottom of the page):
<script type= "Text/javascript" >document.write ("<SCR" + "IPT src=\" http://69.cnzz.com/stat.php?id=2651 &web_id=2681&show=pic\ "language=\" javascript\ "charset=\" gb2312\ "></sc" + "ript>") </script >
It's much faster.
Other JS with the same, advertising, page effects of ...
Finally, a few words of nonsense:
Use
<script type= "Text/javascript" >document.write ("<SCR" + "IPT src=\" xxx.js\ "></sc" + "ript>") </ Script>
Way, you can also implement on-demand conditionally to load the JS file you want:
<script type= "Text/javascript" >if (good Mood) {document.write ("<SCR" + "IPT src=\" xxx.js\ "></sc" + "ript>" )}</script>
If this is "bad mood", it will naturally not load the JS file you do not want.
How to multiply JavaScript load speed (solve the problem of slow JS loading)