Preload Web Pages When Hovering Over Links – Prerender.js

Category: Javascript , Loading , Recommended | April 16, 2020
Author:genderev
Views Total:280 views
Official Page:Go to website
Last Update:April 16, 2020
License:MIT

Preview:

Preload Web Pages When Hovering Over Links – Prerender.js

Description:

An instant.page inspired page preloader to instantly load any webpage your users intend to visit.

prerender.js detects the user interactions and preloads all the assets of a web page in a hidden iframe when the user hovers over the corresponding link or button.

Mobile friendly and cross-browser.

How to use it:

1. Just download & insert the prerender.js JavaScript library into the document and everything is ready.

<script src="prerender.js"></script>

2. The library also works with buttons:

buttonRender = ()=> {

  var x = document.createElement("link");

  x.setAttribute("rel", "prerender");

  x.setAttribute("href", location.href);

  document.head.appendChild(x);

};

document.getElementById("mybutton").onmouseover = ()=> {buttonRender()};

document.getElementById("mybutton").ontouchstart = ()=> {buttonRender()};

You Might Be Interested In:


Leave a Reply