up.link
JavaScript namespace
Features to follow links without a full page load.
Set an [up-follow] attribute to let Unpoly handle a link, and an [up-target] attribute to choose the fragment it updates. The same behavior is available from JavaScript through up.follow(), and up:link:follow lets your code observe or prevent any link Unpoly follows.
Links feel faster with [up-instant], which follows on mousedown instead of click, and [up-preload], which fetches the response before the user clicks. An [up-defer] placeholder loads its content from another URL after the page has rendered, or when it is scrolled into view.
Features
-
up:click EVENT
A
clickevent that honors the[up-instant]attribute. -
Enables keyboard interaction and other accessibility behaviors for non-interactive elements that represent clickable buttons.
-
Follows this link as fast as possible.
-
[up-defer] ATTR
A placeholder for content to be loaded later from another URL.
-
Loads a
[up-defer="manual"]placeholder. -
up:deferred:load EVENT
This event is emitted before an
[up-defer]placeholder loads its deferred content. -
[up-expand] ATTR
Enlarges the click area of a descendant link. A click anywhere in the area does what a click on its link does.
-
Follows the given link with JavaScript and updates a fragment with the server response.
-
[up-follow] ATTR
Follows this link with JavaScript and updates a fragment with the server response.
-
Makes any element behave like a hyperlink.
-
[up-instant] ATTR
Activates this link-like element on
mousedowninstead ofclick("Act on press"). -
up.link.config CONFIG
Configures defaults for link handling.
-
up:link:follow EVENT
This event is emitted when a link is followed through Unpoly.
-
Parses the render options that would be used to follow the given link, but does not render.
-
Returns whether the given link will be followed by Unpoly instead of making a full page load.
-
Returns whether the given link has a safe HTTP method like
GET. -
Makes sure that the given link will be followed by Unpoly instead of making a full page load.
-
Preloads a
GETlink. -
up:link:preload EVENT
This event is emitted before a link is preloaded.
-
[up-preload] ATTR
Preloads this link before the user clicks it. When the link is clicked, the response will already be cached, making the interaction feel instant.