The History Object

The History object represents the browsers history list, which can allow script functions to access the browsers history list.

The History object contains a list of URLs recently visited by the user. It can be accessed to manipulate specific navigation methods.

History Properties
Length
The length property returns the number of current entries in the current history object (i.e. the browser's history list).

History Methods
Back
The back method can be used to load the URL of the document that the browser previously visited. Essentially, it is the same as if the user pressed the 'Back' button on their browser toolbar. I.e.

history.back()

Forward
The Forward method is used to load the URL that is next in the document list (NOTE : This assumes that the user has already navigated 'back' through their history list).

history.forward()

Go
The Go method acts different when used in Netscape or Internet Explorer. In Netscape, the Go method can be used, together with a negative or positive integer value to navigate to any URL present in the history list (assuming that the history object contains enough entries to navigate the required integer value). For example :

history.go(3)

would navigate to the URL three entries ahead of the current document, while :

history.go(-2)

would navigate to the URL 2 entries previous to the current document in the history object.

In Internet Explorer, the Go method is used with a single integer value which represents the absolute position in the history list of the URL to navigate to. For example :

history.go(3)

would navigate to the URL third in the history list.

History Events
The History object has no events.