loadpage的时候有对URL Parameter的判断
浏览器窗口有一个history对象,用来保存浏览历史。
检查浏览器是否支持
if (window.history){
// 支持History API
} else {
// 不支持
}
history对象提供了一系列方法,允许在浏览历史之间移动。
其中包括
history.back();
history.forward();
history.go(0)//刷新当前页面;
HTML5为history对象添加了两个新方法,history.pushState()和history.replaceState(),用来在浏览历史中添加和修改记录。
都会改变浏览器标签栏中的URL值,区别在于pushState()会将之前的地址记录在history对象中,通过back()可以返回前一页,replaceState()则不能返回
我用到的是history.replaceState()
接收三个参数
var shortURL=top.location.href.substring(0,top.location.href.indexOf('?'));
history.replaceState(null,null,shortURL)