instant.page is a client-side JavaScript library that preloads linked pages on hover or touch interactions, making navigation feel instantaneous without consuming unnecessary bandwidth. It works by starting to fetch a page the moment a user hovers over a link for 65 milliseconds, leaving over 300 milliseconds for the page to load before the click, and similarly preloads on touch start for mobile visitors.
The script offers multiple preloading strategies to balance responsiveness with resource conservation. It can be configured to preload on mousedown, when links become visible in the viewport, or only for links explicitly marked with a data attribute. The library respects data saver mode, uses passive event listeners and requestIdleCallback to avoid blocking the main thread, and preloads only the HTML of pages where a visit is highly probable.
For deployment, the script can be self-hosted to bypass content blockers that would otherwise disable prefetching from third-party sources. Additional controls include adjustable preload delays, link whitelisting and blacklisting, support for external domain preloading, and handling of query-string URLs and Vary Accept headers for older Chromium browsers.