浏览器页面的回退实现

history.back():后退
history.forword():前进

history是浏览记录对象,go()方法可以跳到以当前页为基准的某个历史页面
history.go(0): 刷新当前页
history.go(1): 前进+刷新
history.go(-1):后退+刷新
history.go(-n): 回到前第n次的页面

go(-1):返回上一页,原页面表单中的内容会丢失;back():返回上一页,原页表表单中的内容会保留。

猜你喜欢

转载自blog.csdn.net/weixin_40307206/article/details/109897327