HTML禁用浏览器后退功能

    // 禁止浏览器后退
    $(function() {
    
    
        if (window.history && window.history.pushState) {
    
    
            $(window).on('popstate', function () {
    
    
                window.history.pushState('forward', null, '#');
                window.history.forward(1);
            });
        }
        window.history.pushState('forward', null, '#');
        window.history.forward(1);
    })

猜你喜欢

转载自blog.csdn.net/Mr_Clutch/article/details/126684851