<!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>Document</title>
</head>
<body>
<button id="but1">assign</button>
<button id="but2">reload</button>
<button id="but3">replace</button>
<script>
var but1=document.getElementById("but1")
but1.οnclick=function(){
location.assign("http://www.baidu.com")
}
var but2=document.getElementById("but2")
but2.οnclick=function(){
location.reload(true)
}
var but3=document.getElementById("but3")
but3.οnclick=function(){
location.replace("http://www.163.com")
//不会生成历史记录
}
</script>
</body>
</html>