Preload Pages Based On User’s Intention – instant.page

Category: Javascript , Loading , Recommended | February 19, 2023
Author:instantpage
Views Total:80 views
Official Page:Go to website
Last Update:February 19, 2023
License:MIT

Preview:

Preload Pages Based On User’s Intention – instant.page

Description:

instant.page is a small JavaScript library used to boost the page loading speed by preloading target pages when a user intends to click on the link (mouse hover).

It also supports mobile devices that automatically preloads pages when a user starts touching the screen.

Based on the browser link prefetching mechanism.

How to use it:

Just import the instant.page as a module into the document and done.

<script src="//instant.page/1.1.0" type="module" integrity="sha384-EwBObn5QAxP8f09iemwAJljc+sU+eUXeL9vSBw1eNmVarwhKk2F9vBEpaN9rsrtp"></script>

Preload all the links within the document.

<body data-instant-allow-query-string>
  ...
</body>

Preload specific pages within the document.

<a href="articles?page=3" data-instant>
  Page 3
</a>

Prevent specific pages from preloading.

<a href="articles?page=4" data-no-instant>
  Page 4
</a>

Changelog:

02/19/2023

  • Refactor: Group top-level variable declarations

You Might Be Interested In:


Leave a Reply