JavaScript » History » go

Syntax:
history.go(delta)
history.go(location)

The go method loads a specified URL from the History list.

The go method loads a specified URL from the History list. There are two ways of doing this: you can either go to a relative position backwards or forwards in the list, or you can specify all or part of the URL you wish to load. To go to a relative position forwards in the list, you use as the Delta argument a number greater than 0 for the number of places forwards and, likewise, to go to a relative position backwards in the list, you need to specify a negative number equal to the number of places backwards. If the Delta argument is 0, then the current page is reloaded.

Examples

Code:
<INPUT TYPE="button" VALUE="Go" onClick="history.go(-2)">
Explanation:

This code creates a button, which when pressed, loads a page 2 entries previous in the history list.

Code:
<INPUT TYPE="button" VALUE="Go" onClick="history.go('home.newco.com')">
Explanation:

In this example, a button is created, which when pressed, loads the nearest History entry that contains the string "home.newco.com".