history 对象是 window 对象的一部分,可通过 window.history 属性对其进行访问。History 对象包含用户(在浏览器窗口中)访问过的 URL。
一、history对象属性 |
|
length |
返回历史列表中的网址数 |
二、history对象方法 |
|
back() |
加载 history 列表中的前一个 URL |
forward() |
加载 history 列表中的下一个 URL |
go(),-1,0,1 |
加载 history 列表中的某个具体页面 |
进阶实用文档:http://www.cnblogs.com/camille666/p/6194707.html
<script language="javascript"> //防止页面后退 history.pushState(null, null, document.URL); window.addEventListener('popstate', function () { history.pushState(null, null, document.URL); }); </script>