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

Vishalneeraj-24503
Posted by Vishalneeraj-24503 under jQuery category on | Points: 40 | Views : 1138
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.
<body>
<script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type = "text/javascript">
$(function()
{
$(document).keydown(function (e) {
return (e.which || e.keyCode) != 116;
});
});
</script>
</body>

Comments or Responses

Login to post response