Last updated: August 31, 2016
back() – Go to the previous URL entry in the history list. This does the same thing as the browser’s back button.
forward() – Go to the next URL entry in the history list. This does the same thing as the browser’s forward button. This is only effective when there is a next document in the history list. The back function or browser’s back button must have previously been used for this function to work.
go(position) – This function will accept an integer or a string. If an integer is used, the browser will go forward or back (if the value is negative) the number of specified pages in the history object (if the requested entry exists).
go() methods are supported in all major browsers.
History is one of the subobjects of Windows, and an interface to the history stored by your browser. Properties and methods apply to the object history of windows or to each frame in the window.
history.go(0) acts like pressing the reload button.
length property returns the number of URLs in the history list.
Note: Internet Explorer and Opera start at 0, while Firefox, Chrome, and Safari start at 1.
<script> document.write("Number of URLs in history list: " + history.length); </script>
And so I solved the client’s problem.
Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.
If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.