使用history.back()方法可以让JavaScript执行后退操作,返回上一页。例如:
<button onclick="history.back()">返回上一页</button>
或者,使用window.history.go(-1)也可以实现同样的效果:
<button onclick="window.history.go(-1)">返回上一页</button>
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: JavaScript如何实现alert弹框效果