November 17, 1999 - Browsing the History List | WebReference

November 17, 1999 - Browsing the History List

Yehuda Shiran November 17, 1999
Browsing the History List
Tips: November 1999

Yehuda Shiran, Ph.D.
Doc JavaScript

The history.go() method loads a URL from the browser's history list:


The method receives one argument, specifying the relative position of the desired URL in the history list. For example, the following statement is equivalent to the browser's Back button:


Note that an error does not occur if the user tries to go beyond the beginning or end of the history. Instead, the user remains at the current page. Alternatively, you can specify one of the URLs or document titles stored in the browser's history list. The method compares the string against all listings. The first item in the history list to contain the parameter string will be regarded as the match. But, again, no navigation takes place if the item you specify is not listed in the history.

The history object also features to specific methods that are equivalent to history.go(-1) and history.go(1):