Window.history and JavaScript

History is a sub-objects of window, it is an interface to the history stored by your browser.

Properties and methods apply to the object history of window or to each frame in window.

Getting information about the content of history

Properties of the object refer to URLs in the history.

length

Number of pages in the history list.

length=

current, previous and next are not commonly implemented.

location.href can be used in place of current to know the URL of the current page, but it is another object.

location.href=

Methods to use the list as a means of navigation

Used to move from one page to the previous or the next or go to a given page.

back ()

Loading the previous page.

forward ()

Loading the next page, after turning back.

go (x)

Load a page by the number in the list or the URL.
Example: history.go (-2) to cancel the last two clicks.

References

© 2009-2012 Xul.fr