Natizyskunk / flying-pages

Load inner pages instantly, intelligently
ISC License
2 stars 0 forks source link
performance prefetch preload speed web-performance

Flying Pages

Flying Pages prefetch pages before the user click on links, making them load instantly

Quick Links

Buy Me A Coffee

Usage

Quickstart:

<script src="https://github.com/Natizyskunk/flying-pages/raw/master/flying-pages.min.js"></script>
<script>
  flyingPages.listen();
</script>

With options:

<script src="https://github.com/Natizyskunk/flying-pages/raw/master/flying-pages.min.js"></script>
<script>
  flyingPages.listen({
    delay: 2,
    ignoreKeywords: [
      '/connexion',
      '/deconnexion',
      '#'
    ],
    maxRPS: 5,
    hoverDelay: 25
  });
</script>

How it Works?

Flying Pages injects a tiny JavaScript code (1KB gzipped), waits until the browser becomes idle. Then it detects pages in the viewport and on mouse hover and prefetch them.

Flying Pages is intelligent to make sure prefetching doesn't crash your server or make it slow.

Changelog

2021-04-05: mod to make the script work without defer and without having to set options before the script call. Replacing window.FPConfig{}; before the script call with flyingPages.listen(); after the script call (see Usage).