javascript History object

History object

The javascript history object is the window property which is used to load previous, forward or any particular page. It is a property of window object and thus can be written as window.history or only history.


Properties of History Object:

lengthTo get the length of the history URLs.


Methods of History Object:

history.forward() or forward()To load the next page.
history.back() or back()To load the previous page.
history.go() or go()To load the given page number.



<!DOCTYPE html>
function moveForward() {
function moveBack() {
<input type="button" value="Forward" onclick="moveForward()">
<input type="button" value="Back" onclick="moveBack()">
Content Protection by
Please Share