# Prefetch on hover

> Start loading a page while the visitor's pointer rests on its link, so it appears the moment they click. (Pro)

Source: https://arraystory.com/docs/ajaxpress/prefetch/

Prefetch makes page changes feel instant. When a visitor's pointer rests on a link, AjaxPress starts loading that page in the background. By the time they click, the page is usually ready, and it appears straight away.

It needs [AjaxPress Pro](https://arraystory.com/docs/ajaxpress/ajaxpress-pro/).

## Turn it on

Go to **Settings → AjaxPress → Basic**, turn on **Enable Prefetch**, and **Save Settings**. It only shows while **Enable SPA for Frontend** is on.

![With Enable Prefetch, a page starts loading when the visitor hovers a link.](https://r2.arraystory.com/docs/ajaxpress/prefetch.mp4?v=8eea0b35dc)

## How it behaves

- **A short pause first.** Prefetching starts once the pointer has rested on a link for a tenth of a second. Moving across a menu doesn't load every item on the way.
- **One page at a time.** A new hover replaces the page loaded for the previous one, so the extra load on your server stays small.
- **Only links AjaxPress would handle.** Links to other sites, new-tab links, downloads, `#` anchors, wp-admin, and [excluded links](https://arraystory.com/docs/ajaxpress/exclude-links/) are never prefetched.
- **Nothing changes until the click.** A prefetched page stays hidden. If the visitor clicks somewhere else, it's simply dropped.

## Desktop only, in practice

Prefetch relies on hovering. On phones and tablets there's no hover, so pages load on tap as usual.

## Is it safe for my server?

For most sites, yes. Each prefetch is one ordinary page request, the same as a visit, and it only happens after a deliberate pause over a link. Your page cache serves it like any other request.

Think twice on a site where loading a page *does* something:

- **Links that act when visited.** Some links do something the moment their page is loaded: a **Log out** link, a WooCommerce **Add to cart** link on a shop page, or a "delete" or "unsubscribe" link. A prefetch loads the page, so it can carry out the action before the visitor clicks. Add these to [Exclude Links](https://arraystory.com/docs/ajaxpress/exclude-links/), and they're never prefetched:

```text
action=logout
customer-logout
add-to-cart=
```
- **Page view counts.** A prefetched page loads in full, out of sight, with its scripts. So a page a visitor hovered but never opened can be counted as a page view: by server-side statistics, and by browser analytics such as Google Analytics too. If exact page view numbers matter more to you than speed, leave prefetch off, or compare your numbers for a week with it on and off. See [Analytics, Tag Manager and consent banners](https://arraystory.com/docs/ajaxpress/analytics-tag-manager-and-consent-banners/#prefetch-and-page-views).

## Pair it with a transition

Prefetch and [page transitions](https://arraystory.com/docs/ajaxpress/page-transitions/) work well together: a short Fade on a page that's already loaded feels smooth rather than slow.

## For developers

To prefetch a page from your own code, such as the next episode once a podcast starts, use `AjaxPress.preload(url)`. See the [JavaScript extension API](https://arraystory.com/docs/ajaxpress/javascript-extension-api/#preload-a-page).
