我想了解如何在浏览器中单击退格按钮后检测是否重定向到某个页面。是否有可能在jQuery中捕获这种状态?
答案 0 :(得分:0)
感谢您的回复。我的主要目的是在单击退格按钮后禁用从缓存调用页面。我用下面的脚本解决了它:
<script>
if (window.history && window.history.pushState) {
window.history.pushState(null, null, window.location.pathname + window.location.search);
$(window).on('popstate', function () {
window.location = document.referrer;
});
}
</script>