Disable F5 Key (keyboard button) and browser refresh using jQuery.

Posted by Vishalneeraj-24503 under jQuery category on | Points: 40 | Views : 7686
Inside the jQuery document load event handler,I have attached the onkeydown event handler for the document where first the key code is determined and if it is 116 then false is returned to prevent the execution.
<script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type = "text/javascript">
$(document).keydown(function (e) {
return (e.which || e.keyCode) != 116;

Comments or Responses

Login to post response