Usually our website will load some JS code, statistics ah, Google ads Ah, Baidu Alliance Ah, Ali mother Advertising code Ah,
A heap, finally make the page loading speed is very slow, very slow.
Solution: Change the way a JS contains, so that the JavaScript loading speed doubled.
To load the usual way:
<script src= "Xxxx.js" ></script>
Change into:
Copy Code code as follows:
<script type= "Text/javascript" >
document.write ("<SCR" + "IPT src=\" xxx.js\ "></sc" + "ript>")
</script>
As an example:
For example, the following is the application 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 replace it in this way to load (still at the bottom of the page):
Copy Code code as follows:
<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 getting a lot faster.
Other JS is the same, advertising, page effects ...
Finally, a few words of nonsense:
Use
<script type= "Text/javascript" >
document.write ("<SCR" + "IPT src=\" xxx.js\ "></sc" + "ript>")
</script>
The way, but also to achieve on demand according to the conditions to load the JS file you want:
<script type= "Text/javascript" >
if (in good mood) {document.write ("<SCR" + "IPT src=\" xxx.js\ "></sc" + "Ript>")}
</script>
So if "bad mood", it will naturally not load you do not want the JS file.