DekGenius.com
Team LiB   Previous Section   Next Section
History.go( ) revisit a URL

Availability

JavaScript 1.0; enhanced in JavaScript 1.1

Synopsis

history.go(relative_position)
history.go(target_string)

Arguments

relative_position

The relative position in the History list of the URL to be visited. In IE 3, this argument must be 1, 0, or -1.

target_string

A substring of the URL to be visited. This version of the go( ) method was added in JavaScript 1.1.

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 backward. Thus, calling history.go(-1) is equivalent to calling history.back( ) and produces the same effect as clicking 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 Netscape 3, the Location.reload( ) provides a better way of doing this). This form of the method is buggy in multiframe documents in Netscape 3, and in Internet Explorer it can be called only with the values 1, 0, and -1.

The second form of the History.go( ) method was implemented in JavaScript 1.1. It takes a string argument and causes the browser to revisit the first (i.e., most recently visited) URL that contains the specified string.

    Team LiB   Previous Section   Next Section