Tuesday, October 20, 2009

Section 25.143. History.go( ): revisit a URL










25.143. History.go( ): revisit a URL


JavaScript 1.0



25.143.1. Synopsis



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




25.143.1.1. Arguments



relative_position


The relative position in the history list of the URL to be visited.




target_string


A URL (or URL fragment) to be visited, if a matching URL exists in the history list.






25.143.2. 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 away 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.


The second form of the History.go( ) takes a string argument and causes the browser to revisit the first (i.e., most recently visited) URL that contains the specified string. This form of the method is not well specified and may work differently on different browsers. For example, Microsoft's documentation specifies that the argument must match the URL of a previously specified site exactly, while old Netscape documentation (Netscape created the History object) says that the argument may be a substring of a previously visited URL.













No comments: