Closed emaildano closed 5 years ago
Regarding the as
attribute it’s only necessary when using preload, instant.page uses prefetch.
The “API” is done via attributes as detailed on https://instant.page/blacklist so that the library can be loaded asynchronously.
I don’t plan on adding viewport preloading because Quicklink already does that, and I believe it’s not as good a trade-off regarding speed versus server load.
The way to avoid repeat fetching is to add cache headers to the HTML being served. Repeat fetching could be avoided in the script itself but I don’t plan on doing that because cache headers are a better fit for it, and repeat fetching happens rarely enough that it’s not a big worry to have.
I love the idea of this and so far it's off to a good start.
I'm working with Shifter (getshifter.io) which is a static site generator for WordPress and hosting provider. I want to see if there are ways to make the static sites we're creating faster or at least improve the interactivity.
My questions are:
1. Does this library factor in the type of content it's fetching?
It's possible the type or fetch
as
is not being used. Maybe it is and I'm not seeing it. I'm not sure if the type would beas=document
oras=fetch
.Refs:
2. Are you planning on introducing an API for this library?
With an API you can add a few simple options such as the time to prefetch, whether you need to hover at all and instead use the viewport as a trigger, etc.
Refs:
3. Avoid repeat fetching
Maybe this is relate to the first question. On repeat hover, the library will refetch the page. Can this be avoided? Adding the fetch as
text/html
is a possible fix or some JS to skip it.Maybe the Quicklink project already does a lot of this but I love how simple the script you've created is.