I was wandering. Say I've got a big one-page website. Say it has at some point, a very big image. I'd like the browser to give it some kind of download priority. In this case, is it good to use Link prefetching? Or, should I use Link prefetching only for resources belonging to other documents/pages?
1 Answer
You should use preload to fetch resources on high-priority if they are needed for current navigation. prefetch is for resources that may be needed for future navigation.
Keep in mind that preload is a declarative fetch - so the browser is forced to make the resource request. Prefetch is a hint - the browser may or may not load the resource stated for prefetch.
4 Comments
Luca Reghellin
ok, but It it good to use Link prefetching on resources belonging to the same document, or should I use Link prefetching only for resources belonging to other documents/pages?
Punit S
Prefetch should be used for future navigations and not for current navigation.
Luca Reghellin
Ok, now its clear. I would only point out (slightly offtopic here), for future readers, that currently the preload feature is not so widely supported.
Punit S
I agree - preload support is limited.