Window History


The Window History Object

The history object contains the URLs visited by the user (in the browser window).

The history object is a property of the window object.

The history object is accessed with:

window.history or just history:

Examples

let length = window.history.length;
Try it Yourself »
let length = history.length;
Try it Yourself »

History Object Properties and Methods

Property/Method Description
back() Loads the previous URL (page) in the history list
forward() Loads the next URL (page) in the history list
go() Loads a specific URL (page) from the history list
length Returns the number of URLs (pages) in the history list

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.