Loading Please Wait...
The Web History API provides easy methods to access the windows.history object.
The window.history object contains the URLs (Web Sites) visited by the user.
Method | Description |
---|---|
back() | Loads the previous URL in the history list |
forward() | Loads the next URL in the history list |
go() | Loads a specific URL from the history list |
Property | Description |
---|---|
length | Returns the number of URLs in the history list |
The back() method loads the previous URL in the windows.history list.
It is the same as clicking the "back arrow" in your browser.
<button onclick="history.back();">Go Back</button>
The forward() method loads the next URL in the windows.history list.
It is the same as clicking the "forward arrow" in your browser.
<button onclick="history.forward();">Go Forward</button>
The go() method loads a specific URL from the history list.
<button onclick="history.go(-2);">Go Back 2 Pages</button>
The length property returns the number of URLs in the history list of the current browser window.
The property returns at least 1, because the list includes the current page.
This property is useful to find out how many pages the user has visited in the current browsing session.
alert(history.length);
How you feel about this blog:
Share this blog on:
If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com
Contact UsWe are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..
Copyright ©
, Lynxsia IT Solutions, All rights reserved