up.history
JavaScript namespace
Features to update the browser history and handle the Back button.
up.history.location is the current URL as Unpoly sees it, and up:location:changed is emitted whenever it changes, for example to track page views. When the user goes back, up:location:restore is emitted before Unpoly fetches the restored URL and renders it; listeners can prevent this to handle restoration themselves. An [up-back] link points to the previous URL. To change history from your own code, call up.history.push() or up.history.replace().
Features
-
[up-back] ATTR
Changes the link's destination so it points to the previous URL.
-
up.history.config CONFIG
Configures behavior when the user goes back or forward in browser history.
-
Returns whether the given URL matches the current browser location.
-
Returns a normalized URL for the current browser location.
-
Returns a normalized URL for the previous history entry.
-
Adds a new history entry and updates the browser's address bar.
-
Replaces the current history entry and updates the browser's location bar.
-
Returns a normalized URL for the current history entry.
-
up:location:changed EVENT
This event is emitted after the browser's address bar has been updated with a new URL.
-
up:location:restore EVENT
This event is emitted when the user is restoring a previous history entry, usually by pressing the back button.
-
[up-meta] ATTR
Configures whether this
<head>element is updated during history changes.