The window.history object contains the browser’s history. You can load previous and next URLs in the history using back() and next() methods.
1 2 3 4 5 6 | function goBack() { window.history.back() } function goForward() { window.history.forward() } |
Note: You can also access history without window prefix.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.