window popstate event not firing in latest chrome version(122)

101 Views Asked by At

I have noticed that in the latest Chrome version(122), window.popstate event does not fire when we click the browser back/forward multiple times.

I am trying to prevent the back/forward click in my application using the popstate event, it has been working before, but since the latest Chrome update, whenever we click the back/forward button multiple times, it takes me to the previous/visited page or out of my application.

The code I am using to prevent back/forward is below.

window.history.pushState(null, null, null);
window.onpopstate = function (e) {
        window.history.pushState(null, null, null);
        return false;
    }
0

There are 0 best solutions below