Edit this page

up.history up.history.config
JavaScript property

Configures behavior when the user goes back or forward in browser history.

Value

[config.restoreTargets=[]] Array optional

A list of possible CSS selectors to replace when the user goes back or forward in history.

If more than one target is configured, the first selector matching both the current page and server response will be updated.

If nothing is configured, the <body> element will be replaced.

[config.enabled=true] boolean optional

Configures whether fragment updates can update history.

If set to false Unpoly will never change history.

[config.updateMetaTags=true] boolean optional

Configures whether history changes update meta tags in addition to the document's title and URL.

Instead of disabling meta tag synchronization globally you may also disable it per render pass. To do so pass a { metaTags: false } option or set an [up-meta-tags="false"] attribute on a link.

[config.metaTagSelectors] Array<string> optional

An array of CSS selectors matching default meta tags that are be updated during history changes.

By default popular <meta> and certain <link> elements are considered meta tags.

Because of the large number of [rel] attribute values Unpoly the most common link[rel] elements are matched by default. You can include additional elements by assigning an [up-meta] attribute or by pushing their selector into this configuration array.

Only elements in the <head> can be matched. Elements in the <body> are never considered, even if they match one of the configured selectors.

[config.noMetaTagSelectors] Array<string> optional

Exceptions to up.history.config.metaTagSelectors.

Matching elements will not be considered meta tags even if they match up.history.config.metaTagSelectors.