After reading 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?
After reading https://developer.mozilla/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?
Share Improve this question asked Nov 12, 2012 at 1:02 user1015104user10151041 Answer
Reset to default 6It 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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744726169a4590190.html
评论列表(0条)