Skip to content

Commit

Permalink
[prefetch.mdx] Adds a 'load' prefetch strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
wtto00 authored Dec 27, 2023
1 parent ffbcaa7 commit 2720ef4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/content/docs/en/guides/prefetch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Astro supports 3 prefetch strategies for various use cases:
- `hover` (default): Prefetch when you hover over or focus on the link.
- `tap`: Prefetch just before you click on the link.
- `viewport`: Prefetch as the links enter the viewport.
- `load`: Prefetch the links on page load.

You can specify a strategy for an individual link by passing it to the `data-astro-prefetch` attribute:

Expand All @@ -48,7 +49,7 @@ Each strategy is fine-tuned to only prefetch when needed and save your users' ba

- If a visitor is using [data saver mode](https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/saveData) or has a [slow connection](https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/effectiveType), prefetch will fallback to the `tap` strategy.
- Quickly hovering or scrolling over links will not prefetch them.
- Links that use the `viewport` strategy are prefetched with a lower priority to avoid clogging up the network.
- Links that use the `viewport` or `load` strategy are prefetched with a lower priority to avoid clogging up the network.

### Default prefetch strategy

Expand Down

0 comments on commit 2720ef4

Please sign in to comment.