<script type="text/javascript">
document.writeln("Total number of pages in History " + history.length);
</script>
This is the output of your browser history.
window.history.back();
You can see the uses of this in the demo code below.
window.history.forward();
You can read how in with HTML code the back button is displayed to take the visitor to previous page
history.go(-2);
Same way we can move forward or back to any previous page.
Here is the demo of the history object
The code of the demo is here<html>
<head>
<title>Demo of History object to move back or foward in JavaScript</title>
<script type="text/javascript">
function go_fwd(){
window.history.forward();
}
function go_bck(){
window.history.back();
}
</script>
</head>
<body>
<script type="text/javascript">
document.writeln("Total number of pages in History " + history.length);
</script>
<br><br><input type=button value='forward' onClick="go_fwd()";>
<input type=button value='Back' onClick="go_bck()";>
<INPUT TYPE="button" VALUE="go -1" onClick="history.go(-1);">
<INPUT TYPE="button" VALUE="go -2" onClick="history.go(-2);">
</body>
</html>
History
object in JavaScript?History
object returns the number of entries in the history stack?History
object?History
object?History
object?History
object?History
object?jesi | 07-10-2012 |
its working well!..... |
balu | 13-06-2014 |
it was really help full if u guys provide little bit in depth explanations how the above code works thanks for your valuable information. |