Browser Back button disable



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.


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 () {


Does this code work in Internet explorer and mobile devices?


Thnx @Amanjeet,

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


@Aashiverma You are welcome.

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


@Amanjeet, thats great. Thankyou!!!