The HTML5 history API is a standardized way to manipulate the browser history via script. window.history returns a reference to the History object, which provides an interface for manipulating the browser session history (pages visited in the tab or frame that the current page is loaded in).
Syntax
var historyObj = window.history;
Using history
history.back(); // equivalent to clicking back button
history.go(-1); // equivalent to history.back();
History Interface
interface History
{
readonly attribute long length;
readonly attribute any state;
void go(optional long delta);
void back();
void forward();
void pushState(any data, DOMString title, optional DOMString url);
void replaceState(any data, DOMString title, optional DOMString url);
};
Previous version of HTML had a part of this API which included navigating the history. The new parts in HTML5 support a way to add entries to the browser history, to visibly change the URL in the browser location bar without triggering page refresh, and an event that fires when those entries are removed from the stack by the user pressing the browser’s back button.
The support for HTML5 history API is currently limited to the very latest versions of a few browsers.
Explore more about this API :
http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#the-history-interface
http://diveintohtml5.info/history.html
Syntax
var historyObj = window.history;
Using history
history.back(); // equivalent to clicking back button
history.go(-1); // equivalent to history.back();
History Interface
interface History
{
readonly attribute long length;
readonly attribute any state;
void go(optional long delta);
void back();
void forward();
void pushState(any data, DOMString title, optional DOMString url);
void replaceState(any data, DOMString title, optional DOMString url);
};
Previous version of HTML had a part of this API which included navigating the history. The new parts in HTML5 support a way to add entries to the browser history, to visibly change the URL in the browser location bar without triggering page refresh, and an event that fires when those entries are removed from the stack by the user pressing the browser’s back button.
The support for HTML5 history API is currently limited to the very latest versions of a few browsers.
Explore more about this API :
http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#the-history-interface
http://diveintohtml5.info/history.html