1. 程式人生 > >js/jquery禁止頁面回退

js/jquery禁止頁面回退

$(function() {
    //防止頁面後退
    history.pushState(null, null, document.URL);
    window.addEventListener('popstate', function () {
        history.pushState(null, null, document.URL);
    });
})