history 方法

摘抄自MDN 文档,详见 history Api 文档

1
2
3
4
5
history.back()
history.forward()
history.go()
history.pushState()
history.replaceState()

1
2
3
4
5
let stateObj = {
foo: "bar",
};
history.pushState(stateObj, "page 2", "bar.html");
history.replaceState(stateObj, "page 3", "bat.html");