History
History object manages the browser's history stack.
When we open a web browser and surf a web page it creates a new entry in the history stack. As we keep navigating to different pages new entries get pushed into the stack.
To access the history object we can use
To navigate between the different history stack we can use go()
, foward()
and back()
methods of history object.
go(): It is used to navigate the specific URL of the history stack.
Note: the current page position in history stack is 0.
back() : To navigate page backward we use
back()
method.forward(): It loads the next list in the browser history. It is similar to clicking the forward button in the browser.
Last updated
Was this helpful?