在用户浏览的程序中,他们希望 window.history.pushState 生成的历史记录与浏览器中的后退按钮一起使用(因为无论出于何种原因,他们都不会单击应用程序中的后退按钮)
window.history.pushState({"html":'Visited Page',"pageTitle":'Page Title'},"",'http://exampleurl.com/item/');
为了抓住他们点击后退按钮,我只需使用:
$(window).on("popstate", function(e) {
// history.go(-1);
/* As you can see this was an attempt to make it work it only goes back to the last actual page visit */
});
我如何将他们历史记录中的最后一个 URL 获取到 window.location 并将它们发送到那里,或者更好的是如何让浏览器尊重推送的历史记录?
或者无论如何都可以得到 URL 是什么。