title: Prevent browser back button to not go to previous page
body: <p>I want to prevent browser back button to not go to previous page.<br/>
  For this I tried below code:</p>
  
  <pre><code>&lt;script type = "text/javascript" &gt;
          function preventBack() { window.history.forward(); }
          setTimeout("preventBack()", 0);
          window.onunload = function () { null };
      &lt;/script&gt;
  </code></pre>
  
  <p>but when I click on browser back button continuously 2-3 times at one go, it again redirects to previous page. So my above code fails. <br/>
  I don't want user to go to previous page. <br/></p>
  
  <p>I tried this code as well:</p>
  
  <pre><code>&lt;script&gt;
  
      $(document).ready(function () {
          function disableBack() { window.history.forward() }
  
          window.onload = disableBack();
          window.onpageshow = function (evt) { if (evt.persisted) disableBack() }
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>but this code is removing the scroller from browser and I am unable to scroll the page.</p>
  
  <p>Please reply some solution. I tried searching many articles but could not find any solution. </p>