Accessing Browser History
The history object is another child (property) of the window object. This object holds information about the URLs that have been visited before and after the current one, and it includes methods to go to previous or next locations.
The history object has one property you can access:
history.length keeps track of the length of the history listin other words, the number of different locations that the user has visited.
NOTE
The history object has current, previous, and next properties that store URLs of documents in the history list. However, for security reasons, these objects are not normally accessible in today's browsers.
The history object has three methods you can use to move through the history list:
history.go() opens a URL from the history list. To use this method, specify a positive or negative number in parentheses. For example, history.go(-2) is equivalent to pressing the Back button twice.
history.back()loads the previous URL in the history listequivalent to pressing the Back button.
history.forward()loads the next URL in the history list, if available. This is equivalent to pressing the Forward button.
You'll use these methods in the Workshop at the end of this hour.