01-04-2011

Javascript history back and history go

This is how you use the back and go method of the window's history property to imitate the back button, next button or even go back or forth a few entries in the browsers history.

// does the same thing as your back button:
 
window.history.back();
 
//does the same:
 
window.history.go(-1);
 
//takes you three documents back in history:
 
window.history.go(-3);
 
// takes you 2 documents forward in history
 
window.history.go(2);
 
 
 
 

Comments:

Your comment:

»

 

[x]