It it good to use Link prefetching on resources belonging to the same document?

51 views Asked by At

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

There are 1 answers

4
Punit S On

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.