1、js监听回退事件
(function (window, location) { history.replaceState(null, document.title, location.pathname + "#!/stealingyourhistory"); history.pushState(null, document.title, location.pathname); window.addEventListener("popstate", function () { if (location.hash === "#!/stealingyourhistory") { history.replaceState(null, document.title, location.pathname); setTimeout(function () { $('.dialog').css('display', 'block'); }, 0); } }, false); }(window, location));
2、从详情页回退到列表页,并刷新列表页
列表页中添加以下代码,缺点:每次回退都会刷新页面,导致进度条从头开始
window.onpageshow = function(event){ if (event.persisted) { window.location.reload(); } }