History Controller

History Controller is a Stimulus controller for navigating the browser history.

This was really just an early experiment in using Stimulus. Probably no real world value.

Attributes

data- Attributes

All of these attributes are prefixed with "data-" in the attribute name.

Attribute Element(s) Default Value(s) Description
controller * history This attribute provides the history functionality.
action * history#back Takes the browser back to the previous page.
Just like hitting the "Back" button in the browser.
history#forward Takes the browser back to the next page.
Just like hitting the "Forward" button in the browser.
Only relevant if the browser has already gone back
history#go Takes the browser to the point in history indicated by the data-history-goval attribute.

data-history- Attributes

All of these attributes are prefixed with "data-history-" in the attribute name.

Attribute Element(s) Default Value(s) Description
goval * (integer) Indicates where in the browser history the user should be taken.
Negative numbers are how far back. Positive number are how far forward.