After reading https://developer.mozilla.org/en-US/docs/DOM/Manipulating_the_browser_history and playing around with history.api I am wondering how to use first parameter in
history.pushState(stateObj, title, url);
I understand that stateObj is a js object so something like this:
{
par1 : 'par1',
par2 : 2
}
But how I have to use it? What method gives me the possibility to retrieve this object later.
I also understood that title is not used right now and I have to use my own javascript methods to change the title of the page. Am I right?
It is extremely easy: all you have to do is:
history.pushState({
par1 : 'par1',
par2 : 2
}, '', 'url');
To get this object you have to do
var tmp = history.state;
tmp will be equal to
{
par1 : 'par1',
par2 : 2
}
Regarding the second question. As far as I know - you are right. For example you can send your title in that object, you were asking in the first question.