how to disable the Internet Explorer refresh button with javascript

-1

I am trying to disable the browser refresh button using javascript, so far I have only managed to disable the pressing of a combination of keys, but I have not achieved the button event, I have this code for that:

$(document).keydown(function (e) {
    if (e.key == "F5") {
        window.onbeforeunload = null;
    }

The button I refer to is this:

    
asked by user950489 05.06.2018 в 12:40
source

1 answer

-1

You can not disable the functionality of the browser back button. The only thing if you can do it is to avoid it . Next I leave the JavaScript code that should be placed in the main section of the page where you want the user NO to go back with the back button:

<script>
  function preventBack(){window.history.forward();}
  setTimeout("preventBack()", 0);
  window.onunload=function(){null};
</script>
    
answered by 05.06.2018 в 17:47