Skip to main content

PrefetchController

Purpose​

Preload links when they come into view, or the user hovers over them.

Actions​

ActionPurpose
--

Targets​

TargetPurposeDefault
---

Classes​

ClassPurposeDefault
---

Values​

ValueTypeDescriptionDefault
modeStringWhich mode to use for prefetching links. intersect - When the link comes into the viewport. mouseover - When the user hovers over the linkmouseover

Events​

EventWhenDispatched onevent.detail
----

Side Effects​

None

How to Use​

The controller will preload links by injecting a <link rel="prefetch" as="document" href="..."> element into the document <head>.

It will only do so if there is not already a prefetch link with the same href already in the <head>.