function pushHistory() {
var state = {
title: "title",
url: "/gfyun-app-web/rest/wxHomePage/goIndex"
};
//url是后退页面地址location.href是后退页面点击后退返回的页面
window.history.pushState(state, "index", location.href);
// 第二个实体 不要以为最后的空实体没有用 可以解决上来就执行popstate的问题 相当于炮灰
state = {
title: "index",
url:"#"
};
window.history.pushState(state, "index", "");
}
pushHistory();
window.addEventListener('popstate', function(e) {
location.href = window.history.state.url;
});