Widely available Supported across all major browsers. Safe to use in production.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
1
12
1
1
18
1

The back() method of the History interface causes the browser to move back one page in the session history.

1
12
1
1
18
1

The forward() method of the History interface causes the browser to move forward one page in the session history. It has the same effect as calling History.go.

1
12
1
1
18
1

The go() method of the History interface loads a specific page from the session history. You can use it to move forwards and backwards through the history depending on the value of a parameter.

1
12
1
1
18
1

The length read-only property of the History interface returns an integer representing the number of entries in the session history, including the currently loaded page.

1
12
1
1
18
1

The pushState() method of the History interface adds an entry to the browser's session history stack.

5
12
4
5
18
4

The replaceState() method of the History interface modifies the current history entry, replacing it with the state object and URL passed in the method parameters. This method is particularly useful when you want to update the state object or URL of the current history entry in response to some user action.

5
12
4
5
18
4

The scrollRestoration property of the History interface allows web applications to explicitly set default scroll restoration behavior on history navigation.

46
79
46
11
46
11

The state read-only property of the History interface returns a value representing the state at the top of the history stack. This is a way to look at the state without having to wait for a Window/popstate_event event.

19
12
4
6
25
6

PopStateEvent is an interface for the Window/popstate_event event.

4
12
4
6
18
6

The hasUAVisualTransition read-only property of the PopStateEvent interface returns true if the user agent performed a visual transition for this navigation before dispatching this event, or false otherwise.

118
118
149
18
118
18

The PopStateEvent() constructor creates a new PopStateEvent object.

16
14
11
6
18
6

The state read-only property of the PopStateEvent interface represents the state stored when the event was created.

4
12
4
6
18
6

The Window.history read-only property returns a reference to the History object, which provides an interface for manipulating the browser session history (pages visited in the tab or frame that the current page is loaded in).

1
12
1
1
18
1

The popstate event of the Window interface is fired when the active history entry changes while the user navigates the session history. It changes the current history entry to that of the last page the user visited or, if history.pushState() has been used to add a history entry to the history stack, that history entry is used instead.

5
12
4
5
18
4.2
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Implementation note
  • Until Firefox 5, the passed object is serialized using JSON. Starting in Firefox 6, the object is serialized using the structured clone algorithm. This allows a wider variety of objects to be safely passed.
Notes 1 item(s)
Implementation note
  • Until Firefox 5, the passed object is serialized using JSON. Starting in Firefox 6, the object is serialized using the structured clone algorithm. This allows a wider variety of objects to be safely passed.
Notes 1 item(s)
Implementation note
  • Before version 34, Chrome would fire a `popstate` event on page load.
Notes 1 item(s)
Implementation note
  • Before version 10, Safari would fire a `popstate` event on page load.
Notes 1 item(s)
Implementation note
  • Before version 34, Chrome Android would fire a `popstate` event on page load.
Notes 1 item(s)
Implementation note
  • Before version 10, Safari on iOS would fire a `popstate` event on page load.

Use cases

  • Using History

    The History interface of the History API allows manipulation of the browser session history, that is the pages visited in the tab or frame that the current page is loaded in.

Cautions

  • May not be supported in older browsers.

Implementation notes

  • Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.