Answers for "js disable back button"

-1

disable back button in browser

<script type="text/javascript">  function preventBack() {window.history.forward();}  setTimeout("preventBack()", 0);  window.onunload = function () {null};</script>
Posted by: Guest on June-14-2020
0

how to disable back js

history.pushState(null, null, null);
$(window).on("popstate", function (event) {
  if (!event.originalEvent.state) {
    history.pushState(null, null, null);
    return;
  }
});
Posted by: Guest on March-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language