1、history.go()
最常用的一种方法,可以返回、前进任意一步的页面、回到上一页
|
1
2
3
4
5
6
|
// 回到上一页window.history.go(-1);// 回到下一页window.history.go(1);// 回到任意一页widnow.history.go(+前进几页) |
2、history.back()
back() 方法可加载历史列表中的前一个 URL(如果存在)。
调用该方法的效果等价于点击后退按钮或调用 history.go(-1)。
|
1
2
|
// 回到上一页history.back() |
3、document.referrer
支持新窗口返回上一页
|
1
2
3
4
5
|
// new page// 获取上一页的urlconst prevPageUrl = document.referrer;// 跳转上一页document.location,href = prevPageUrl; |
© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...