Home > Article > Web Front-end > History object in JavaScript_Basic knowledge
The History object in JavaScript contains information about the URLs that the user has browsed, which means that the history object refers to the browsing history of the browser. Due to security requirements, this object has received many restrictions and now only the following properties and methods remain. The History object has the length attribute, which lists the number of history items. The history that JavaScript can manage is limited to the range that can be reached using the browser's "forward" and "back" keys. This attribute returns the sum of the addresses contained under the "forward" and "backward" buttons.
History object has the following methods
back() to go back, which is equivalent to pressing the "Back" key.
forward() forward, which is equivalent to pressing the "forward" key.
go() Usage: history.go(x); Go to a specified address within the history range. If x 0, advance x addresses. If x == 0, refresh the currently opened web page. history.go(0) and location.reload() are equivalent.