<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5无刷修改url</title>
<script type="text/javascript">
function changeURL(){
var mask2 = document.getElementById('mask2').value;
window.history.pushState({},0,'https://'+window.location.host+'/'+mask2);
}
</script>
</head>
<body>
<h1>html5无刷新改变url</h1>
<div id="info" style="margin:30px 0;">
页面真实地址:
<span style="color:red;"><script type="text/javascript">document.write(window.location.href);</script></span>
</div>
<div>
请输入要改变地URL字符串:<input id='mask2' type="text" />
<button onclick="changeURL();">点击无刷改变url</button>
</div>
</body>
</html>