1 year ago

#270066

test-img

user13302816

history.pushState() not working properly on phone

I have a chap app where user first fills up a form then they are redirected to the chat page. Now the problem is when user clicks the back button they goes back to the login form.

So I used this code to prevent going back,

history.pushState({}, '', "inbox");

history.pushState({}, '', "again-inbox");

window.onpopstate = ()=>{
  history.forward();
}

It works fine on PC but does not work on android browsers.

javascript

pushstate

0 Answers

Your Answer

Accepted video resources