-1

I have requirement to disable page back navigation of the browser..Can Any one please help me to achieve these through javascript

prasanth
  • 75
  • 1
  • 11
  • 1
    Possible duplicate of [how to stop browser back button using javascript](https://stackoverflow.com/questions/12381563/how-to-stop-browser-back-button-using-javascript) – Sid Oct 11 '18 at 05:23

2 Answers2

0

Its a client side behavior , you can achieve it using javascript as the following :

history.pushState(null, null, location.href);
window.onpopstate = function () {
    history.go(1);
};
Ashraf
  • 2,612
  • 1
  • 20
  • 35
0

It's in jquery.

$(document).ready(function() {
         function disablePrev() { window.history.forward() }
         window.onload = disablePrev();
         window.onpageshow = function(evt) { if (evt.persisted) disableBack() }
      });
Orgil
  • 251
  • 4
  • 19