JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

History.go() Method

Name

History.go() Method---revisit a URL

Availability

Buggy in Navigator 2.0 and 3.0, partially implemented in Internet Explorer 3.0

Synopsis

history.go(relative_position)
history.go(target_string)   buggy in 2.0

Arguments

relative_position

The relative position in the History list of the URL to visit. In Internet Explorer 3.0, this argument must be 1, 0, or -1.

target_string

A substring of the URL to be visited. This version of the go() method is buggy in Navigator 2.0 and not implemented in Internet Explorer 3.0.

Returns

Nothing.

Description

The first form of the History.go() method takes an integer argument and causes the browser to visit the URL that is the specified number of positions distant in the history list maintained by the History object. Positive arguments move the browser forward through the list and negative arguments move it backwards. Thus, calling history.go(-1) is equivalent to calling history.back(), and, in Navigator, produces the same effect as a user click on the Back button. Similarly, history.go(3) revisits the same URL that would be visited by calling history.forward() three times. Calling go() with an argument of 0 causes the current page to be reloaded (although in Navigator 3.0, the Location.reload() provides a better way of doing this). This form of the method is buggy in multiframe documents in Navigator 3.0, and in Internet Explorer, it can only be called with the values 1, 0, and -1.

The second form of the History.go() method takes a string argument. It is supposed to make the browser revisit the first (i.e., most recently visited) URL that contains the specified string. Unfortunately, in Navigator 2.0, this form of the method is buggy and may cause the browser to crash. This form of the method is not implemented in Internet Explorer 3.0.

Because of the various bugs and incompatibilities in this method, it is best avoided. Use the back() and forward() methods instead.

Bugs

This method does not work correctly in multiframe documents in Navigator 3.0, and may crash Navigator 2.0 when called with a string argument. Its behavior in Internet Explorer 3.0 is incompatible with Navigator 2.0.

See Also

"History", "History.back()", "History.forward()"


Previous Home Next
History.forward() Book Index History.length

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell
This HTML Help has been published using the chm2web software.