Browser Back button disable

confirmit

#1

Is there any way we can disable the browser back button. Actually, we have not provided back button in our survey, but few respondents tried to use browser back button to change their previous responses.

We need to stop this happen in our survey.


#2

There is a generic javacript code to disable backbutton.

Try using the the below code if it helps you

history.pushState(null, null, location.href);
window.onpopstate = function () {
  history.go(1);
};

#3

Does this code work in Internet explorer and mobile devices?


#4

Thnx @Amanjeet,

I have tried your code and it worked well in my survey.


#5

@Aashiverma You are welcome.

@yayati_raj, yes this code works on all browsers and devices.


#6

@Amanjeet, thats great. Thankyou!!!