Applying Your WordPress With A Preload Function

Ever wonder why Chrome was faster than most other browser? It’s mainly due to its preload function for all of its pages.

At present, there are still a few people who may use, that is InstantClick, which is equivalent to a JS library, run principle similar to “pre-load”


Use mouseover (), mousedown (), mouseout () to perform the entire process, the operating principle: when the mouse over the link, it has begun to load the page, and hover from the mouse to click on the link that links the middle there are so few hundred milliseconds interval, then the page has been loaded or less, then open the page in a real equal to directly show, speed is very fast. So this is not simply Ajax, but pushState + Ajax, that is PJAX, like the entire page Ajax (Ajax and true distinction).

Download the annex will be placed inside two js js folder theme directory, then you can before the </ body> tag references in footer.php, reference code:


Then you’re done, click open the page, you will find the top there is a loading progress bar, you can modify its style through CSS.

This effect can sometimes conflict with some Ajax effects, such as comments Ajax, because InstantClick is against the body, including, of course, will include comments template, so when you do not want to use InstantClick effect of a particular region, you can use <div data-no- instant> and </ div> this declaration to include the area in the area of ??data-no-instant click event will not trigger pre-loaded, this way you can do better compatible effects.

About the author: Magee