Class: History

html.History

Class representing the browser history.

This element allows you to forge artificial history entries in order to make use of the Back and Forward buttons of the browser.

new html.History ()

Extends

Methods

append (state)

Appends the history by a new entry represented by a state object. Entries newer than the current entry will be lost.

Most browsers use the current document title to name the history entry.

Name Type Description
state any

The history state. This may be any JSON-serializable object.

back (amount)

Moves the history back by the given amount of entries, which will trigger the load event with the corresponding state object.

Name Type Description
amount number

(default: 1) The amount of entries to move back.

forward (amount)

Moves the history forward by the given amount of entries, which will trigger the load event with the corresponding state object.

Name Type Description
amount number

(default: 1) The amount of entries to move forward.

replace (state)

Replaces the current entry of the history by a new entry represented by a state object.

Most browsers use the current document title to name the history entry.

Name Type Description
state any

The history state. This may be any JSON-serializable object.

Events

html.History.event:load

Is triggered when a history object is to be loaded.

Name Type Description
state any

A state object representing the history entry.