Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

pushState

The pushState() method of the History object adds a new state object entry to the user's browsing history and manipulates the url string in the address bar. In the browsing history a single document can have different 'states'(instances) of itself in the history stack according to url configuration. Data can be preserved in the browsing context session for each instance of the document. Variables in the url can make a different instance of the document that gets put into the browsing history. State object data can be retrieved using the history.state property. A state can be updated using the replaceState() method.

Syntaxhistory.pushState( data, title, url )

Parameters

data A data object that will be associated with the history entry. Accessible any time via history.state. title Short title for the state object. url The URL associated with the new state object. The address bar will change to this value if set differently than current location.

Examples

var data = { data1:"abc", data2:"def", data3:"ghi" }; history.pushState(data , "short title", "?id=1");

JavaScript

Methods

addEventListeneralertaveragebackblurconcatcreatedecodeURIdecodeURIComponentencodeURIencodeURIComponentevaleveryfilterforwardgoisArrayisFiniteisNaNjoinparseFloatparseIntpoppushpushStatereducereplaceStatereverseshiftshuffleslicesomesortspliceunshiftwrite