0

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?

Luca Reghellin
  • 7,426
  • 12
  • 73
  • 118

1 Answers1

1

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.

Punit S
  • 3,079
  • 1
  • 21
  • 26
  • 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? – Luca Reghellin Nov 29 '18 at 14:51
  • 1
    Prefetch should be used for future navigations and not for current navigation. – Punit S Nov 30 '18 at 06:14
  • 1
    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. – Luca Reghellin Nov 30 '18 at 10:39
  • I agree - preload support is limited. – Punit S Nov 30 '18 at 12:19