History

The history of URLs visited by the visitor's browser.

Properties

length

FF, IE 4

Number of URLs in the history list

Methods

back()

FF, IE 3

Returns to the previous page (like clicking the browser's back button)

Example:

history.back();

forward()

FF, IE 3

Advances to the next page (like clicking the browser's forward button)

Example:

history.forward();

go()

FF, IE 3

Takes one parameter: the number of URLs to advance (positive values) or go back (negative values). In IE 3, the parameter can be only −1, 0, or 1.

Example:

history.go(-2);

Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.