Disable Back Button in Browser Using jQuery

AuthorSumit Dey Sarkar

Pubish Date26 Aug 2022


In this tutorial we will learn how to disable back button in browser using jQuery.

Here we will use window.history.pushState for restrict back button of browser in jQuery.

let's see the example - 

How to disable back button in browser using jQuery

<!DOCTYPE html>

  <title>Disable Back Button in Browser Using jQuery</title>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>


  <button>click on browser back button</button>

  <script type="text/javascript">
    $(document).ready(function () {
      window.history.pushState(null, "", window.location.href);
      window.onpopstate = function () {
        window.history.pushState(null, "", window.location.href);


Comments 0

Leave a comment