0

我想了解如何检测在浏览器中单击退格按钮后我是否被重定向到页面。是否有可能在 jQuery 中捕捉到这种状态?

4

1 回答 1

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>
于 2016-06-29T06:05:46.827 回答