pushState
2017-04-19 17:53:06 0 举报
history 的pushState 的作用过程
作者其他创作
大纲/内容
会触发 window.onpopstate 事件页面的url 为a.html 并且内容也变成a.html第五步:再执行history.go(-1)
第一步:输入 http://www.processon.com展示http://www.processon.com 的页面内容第二步:在console 中执行下面的内容
history.state = 得到的结果是:{stateKey:\"a\"}history.go(-1)
history.go(-1);
会触发window.onpopstate事件url 发生变化但是内容还是a.html
\bhttp://baidu.com
history.state; = 得到结果: {stateKey:\"a\"}
可以看到页面展示的内容不变,还是展示http://www.processon.com 的页面内容。但是url 已经变了
http://www.processon.com
http://www.processon.com/a.html
var stateObj = { stateKey : \"a\
第三步:输入http://www.baidu.com页面展示百度的首页第四步:在console 下执行 history.go(-1)
history.state = 得到的结果是:null
0 条评论
下一页