Edit this page

up.link [up-preload]
HTML selector

Preloads this link before the user clicks it. When the link is clicked, the response will already be cached, making the interaction feel instant.

Unpoly will only preload links with safe methods. The [up-preload] attribute has no effect on unsafe links.

Links with the [up-preload] attribute are always followed by Unpoly and will not make a full page load.

See preloading links for more details and examples.

Example

<a href="/path" up-preload>Hover over me to preload my content</a>

Modifying attributes

Info

All attributes for [up-follow] may also be used.

[up-preload='hover'] optional

When to preload this link.

When set to 'hover' (the default), preloading will start when the user hovers over this link for a while. On touch devices preloading will begin when the user places her finger on the link. Also see preloading on hover.

When set to 'insert', preloading will start immediatedly when this link is inserted into the DOM. Also see eagerly preloading on insertion.

When set to 'reveal', preloading will start when the link is scrolled into the viewport. If the link is already visible when inserted, preloading will start immediately. Also see preloading when a link becomes visible.

[up-preload-delay] optional

[up-preload="hover"], this requires the user to hover for the given number of milliseconds before the link is preloaded.

Defaults to up.link.config.preloadDelay.

[up-intersect-margin='0'] optional experimental

With [up-preload=reveal], this enlarges the viewport by the given number of pixels before computing the intersection.

A positive number will load the deferred content some pixels before it becomes visible.

A negative number will require the user to scroll some pixels into the element before it is loaded.