windows窗口对象(历史)
history.go(),history.back(),history.forward()。
因为windows对象引用不是必须的。所以windows.history.go() == history.go()的。
window.history.go(-1);
要前进一页,只需要使用正数;
history.go(1);
history.back(); 后退
history.forward(); 前进
2.history.go(-1)和history.back()的区别
history.go(-1)表示后退与刷新。如数据有改变也随之改变
history.back()只是单纯的返回到上一页。
$("#btn_exit").bind("click",function(){
window.location.reload(); //刷新
window.history.go(1); //前进
window.history.go(-1); //返回+刷新
window.history.forward(); //前进
window.history.back(); //返回
});
window.location.href = document.referrer;//返回上一页并刷新
返回上一页刷新:
<input type="button" value="返回" οnclick="javascript:window.location.replace(document.referrer);"/>
<a href="javascript:document.parentWindow.location.reload()">返回上一页面刷新的是自己</a>
<a href="history.html" οnclick="javascript:location.replace(this.href);event.returnValue=false; ">返回上一页并刷新页面</a>