Skip to content

ttulka/prelinks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PreLinks - eager caching for web pages

  • Cached before even visited!
  • TurboLinks on steroids :-)

This simple plugin loads and caches pages when the user shows a mere intention to visit a link - she just moves the cursor over the link and the target page is cached immediatelly.

That results in a very quick navigating among pages, lower load, and better user experience.

Once cached switching between links is super quick, the HTTP request is performed only once.

HTML head elements are merged, scripts are executed.

Small (6 KB) and easy to use.

Best fit for server-side rendered websites.

Demo

https://ttulka.github.io/prelinks/index.html

Build

npm install
npm run bundle

Usage

Put the script to the bottom of <body> into each HTML page:

<script src="prelinks.min.js" id="prelinks" defer></script>

Settings

Disable prelinks for a link

To disable prelinks on a particular link, add the attribute data-prelinks="false":

<a href="..." data-prelinks="false">...</a>

Disable caching for a link

To disable caching for a particular link, add the attribute data-prelinks-cache="false":

<a href="..." data-prelinks-cache="false">...</a>

Progress action

To enable an action for loading a page, put a meta tag prelinks-progress into <head>:

<meta name="prelinks-progress" content="blur">

Possible values for content are:

  • none (default)
    • no action
  • blur
    • blur page

Disable all caching

To disable caching completelly, put a meta tag prelinks-cache-control with content="no-cache" into <head>:

<meta name="prelinks-cache-control" content="no-cache">