JAVASCRIPT 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)` 





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

GocourseAI

close
send