-
window.history.go(
-1); 返回上一页, 原页面表单中的内容会丢失;
-
-
window.history.back(
-1); 返回上一页, 原页面表单中的内容会保留.
以下为举例:
-
<input type="button" value="刷新" οnclick="window.location.reload()">
-
<input type="button" value="前进" οnclick="window.history.go(1)">
-
<input type="button" value="后退" οnclick="window.history.go(-1)">
-
<input type="button" value="前进" οnclick="window.history.forward()">
-
<input type="button" value="后退" οnclick="window.history.back()">
-
<input type="button" value="后退+刷新" οnclick="window.history.go(-1);window.location.reload()">
关于刷新:
-
window.history.go(
0); 是直接读取缓存数据,不会从服务器端获取数据;
-
window.location.reload(
true); 不管有没有缓存,都会强制刷新;
-
window.location.reload(
false); 有缓存就走缓存,没缓存就强制刷新;