<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>html5访问历史记录</title>
</head>
<body>
<input onclick="add()" type="button" value="访问历史记录"/>
<script>
function add(){
if(window.history && history.pushState){
history.pushState("数据","标题","?demo="+new Date().toLocaleTimeString());
}else{}
window.addEventListener("popstate", function (e) {
//后退或者前进操作
console.log(e.state);
});
}
</script>
</body>
</html>
html5-访问历史记录
最新推荐文章于 2021-06-08 23:37:54 发布
1561

被折叠的 条评论
为什么被折叠?



