<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<script type="text/javascript">
if (window.history&&history.pushState) {//判断浏览器是否支持历史记录压入
history.pushState("title","asdfasdf","?demo="+new Date().toLocaleTimeString());
}else{
}
//重写取出历史记录方法
//点击浏览器后退历史按钮事件
window.addEventListener('popstate',function(evt){
//document.body.innerHTML=new Date().toLocaleTimeString();
document.body.innerHTML=evt.state;
});
</script>
<body>
<input type="button" value="添加历史记录">
</body>
</html>