window.history对象属性
在被人的代码中看到如下操作:
$(document).ready(function () {
if (window.history && window.history.pushState) {
$(window).on('popstate', function () {
window.history.pushState('forward', null, '');
window.history.forward(1);
});
}
//
window.history.pushState('forward', null, ''); //disable in IE
window.history.forward(1);
});
搜了相关的知识
https://www.w3cschool.cn/nwfchn/5ampgozt.html
https://www.cnblogs.com/sh-zj/p/9714467.html
上述代码具有设置某一url为首页的作用,点击回退按钮仍然是当前页面和url。