window.history.pushState not going back in history

∥☆過路亽.° 提交于 2019-11-30 16:09:34

Figured it out, I just added:

    window.addEventListener("popstate", function(e) {
    loadPage(location.pathname);
});

to the end of the page

I have same problem, but I fixed it. It's very easy

code example:

window.addEventListener("popstate", function(e) {
    window.location.href = location.href;
});

Yeah Safari iOS has a fair few bugs with the HTML5 History API - actually, all the HTML5 browsers work differently than each other, so the functionality isn't really that standard right now.

There is History.js which solves the cross-browser compatibility problems and also provides an optional HTML4 hash fallback if you'd like. You can also refer to the "Notes on Compatibility" section for information on all the browser bugs that it fixes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!