Consider you're reading a blog post. While reaching the bottom you can see related posts. What if your browser will preload those pages even before you click?
Super fast inner pages, right?
Introducing Quicklink
QuickLink is a tiny JavaScript code that will detect links within the viewport and prefetches URLs to the links.
Installation
npm install --save quicklink
import quicklink from "quicklink/dist/quicklink.mjs";
quicklink();
But it will load unnecessary data, will it slow down my user?
Quicklink waits until the browser is idle, checks if the user isn't on a slow connection or has data-saver enabled.
Result? Those URLs will load instantly!
Will it slows down my website?
It's only < 1KB minified/gzipped
Did it help?
Follow me on Twitter, I share a lot of cool stuff there
Top comments (9)
Thanks. You can also use like this;
also, you can use
ignore
optionAre you actively using it?
No. But I'm interested in new approaches and libraries.
Looks like Dev.to have something similar using service workers. Hashnode is also using the same
Isn't dev.to a preact SPA? (with ssr) and not a server rendered site?
I'm not sure whether it's SSR or not. But they prefetch posts when we hover on it
It's SSR
@ben why is there a whole html in there :O
oh nice!
Cool. Thanks