Home >Web Front-end >JS Tutorial >Optimize page loading speed plugin InstantClick

Optimize page loading speed plugin InstantClick

php中世界最好的语言
php中世界最好的语言Original
2018-04-17 16:57:341841browse

This time I bring you the plugin InstantClick to optimize the page loading speed. What are the precautions when using the plugin InstantClick to optimize the page loading speed? The following is a practical case, let’s take a look.

Usually, in order to reduce the query time of DNS, we can use dns prefetch to parse the links in the page and improve the loading speed of the page. Similarly, we can load the page during the time between when the mouse slides over the link and when it is clicked. This gap usually lasts a few hundred milliseconds. Using InstantClick, we can make full use of these hundreds of milliseconds to allow the website to display a new page instantly, almost No delays.

InstantClick installation

Installing InstantClick is very simple. Just download InstantClick and put it in a certain directory, and then quote the code before , for example:

<script src="//img.ezloo.com/static/instantclick.min.js" data-no-instant></script>
<script data-no-instant>InstantClick.init();</script>

InstantClick may cause a white screen to appear. The official gave an example and solved it with Google. Conflict between Adsense. I found that Baidu Statistics can also cause a white screen. Adding data-no-instant to