JavaScript Kit > JavaScript Reference > Here


Last updated: June 20th, 2004

The History object contains an array of previously visited URLs by the visitor. To simulate the browser's back button, for example, you can use the History object:

<a href="javascript:history.go(-1)">Go back</a>


Properties Description
length Returns the number of URLs in the browser's history list.


Methods Description
back() Loads the previous URL in the history list.
forward() Loads the next URL in the history list.
go(whereTo) Goes to a specific URL within the history list. "whereTo" can be an integer to go to a URL within a specific position relative to the current (ie: -1 goes back one page, 1 goes forward one), or a string. For the string, enter a partial or full URL, and the function to match and go to the first URL that matches the string. Example(s).



<a href="javascript:history.go(-3)">Go back 3 pages</a>

<a href="javascript:history.go('')">Go to nearest URL in history list with "" in the URL.</a>

Reference List

Right column

CopyRight (c) 2015 JavaScript Kit. NO PART may be reproduced without author's permission. Contact Info