history don't manage the history of the browser but the history of the session of the active tab(or window)
This is the different properties and methods of the history object:
The back method
serves to go to the previous page
, it is the equivalent of the previous button of your browser
The forward method
do the opposite of back, she will redirect you to the next page if exist, otherwise nothing happen. it is the equivalent of the next button of your browser
The go method let you go backward and forward with the possibility to skip pages example:
This is the content of the history:
go(0); will redirect you to http://www.webestpp;s.com/ because it is the current page.
go(-2); will redirect you to http://www.google.com/ because you move back 2 pages.
go(1); will redirect you to http://www.w3.org because you move forward 1 page.
The length poperty let you know the number of pages in your history.
document.write("You history contain :"+history.length+" page(s)");
Some browsers limits the number of pages in the history to 50, firefox for example limit it to 50(by default) if you visit more than 50 pahes you can go maximum 50 pages forward of backward.
I hope this tutorial will be useful.
Similar Scripts and Tutorials