xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

HTML5 History API & URL 重定向

HTML5 History API & URL 重定向

disabled server url redirect

https://developer.mozilla.org/en-US/docs/Web/API/History_API

https://css-tricks.com/using-the-html5-history-api/

window.history.back();
window.history.go(-1);


window.history.forward();
window.history.go(1);

window.history.go(0);//the same like:
window.history.go();


let numberOfEntries = window.history.length;

let currentState = history.state;

history.pushState() & history.replaceState()


let stateObj = {
    foo: "bar",
};
​​​​​​​
history.pushState(stateObj, "page 2", "bar.html");

history.replaceState(stateObj, "page 3", "bar2.html");

demo

https://developer.mozilla.org/zh-CN/docs/Web/API/History_API/Example

https://developer.mozilla.org/en-US/docs/Web/API/History_API

refs



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2019-03-20 14:28  xgqfrms  阅读(768)  评论(8编辑  收藏  举报