October 23, 2018

Disable Page Refresh

Sometimes you need to disable the Windows Default “F-5” key if you have some web page which is submitting information like a form to a database script or feedbacks, and using the refresh key by the user may lead to the submission of the form once again or twice? Use the following Javascript and keep the same in the head Section of your webpage to disable Page Refresh throgh F-5 key. May not work with older versions of IE or some other Browsers like Google Chrome.


Put the code before end of “Head” Section of your webpage HTML.

head tag in html


<script>
if (document.all) {
document.onkeydown = function () {
var key_f5 = 116; // 116 = F5
if (key_f5==event.keyCode) {
event.keyCode=0;
alert ("Sorry! You can not refresh this page!");
}
}
}
  </script>


HOW TO DISABLE PAGE REFRESH SCRIPT

Freeware REVIEWS

TRUSTMEHER WEB SERVICES AND HOSTING