JS HISTORY OBJECT

Lavanya



JavaScript History Object

The JavaScript history object stores a list of URLs visited by the user. It allows you to navigate to previous, forward, or specific pages.

The history object is a property of the window, so it can be accessed using:

`window.history`
  Or,
`history`

Property Of JavaScript History Object 

The history object has only one property.







Methods Of JavaScript History Object

The history object has only three methods.






Example Of  History Object 

Here are the various ways to use the history object.

1. Go back to the previous page:

`history.back()`

2. Go forward to the next page:

`history.forward()`

3. Go to a specific page in the session history:

`history.go(2)` 







More topic in JavaScript

Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send