/**********************************这是首页*********************************/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>INDEX</title>
</head>
<body>
<P>我是首页</P>
<br>
<button onclick="show()">点击我跳转</button>
</body>
<script>
function show(){
window.history.replaceState(2, 1, './a.html')
window.location.reload();
}
</script>
</html>
/*********************************要跳转的页面******************************/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>a</title>
</head>
<body>
<h1>hhhhhhhhhhhhh</h1>
<br>
<button onclick="show()">点击我返回</button>
</body>
<script>
function show(){
window.history.replaceState(2, 1, './index.html')
window.location.reload();
}
</script>
</html>
window.history.replaceState(state, title,url) //无记录页面跳转
window.location.reload(); //url 更换了 页面却不会重新加载 作用:重新加载