Disable reboot and f5 on my php page

I use a timer on my php page, but when some page refresh starts from the beginning of the timer. I want to disable the f5 or reload option on my php page.

Thanks in advance

+5
source share
3 answers

I am testing it and it works.

function disable_f5(e)
{
  if ((e.which || e.keyCode) == 116)
  {
      e.preventDefault();
  }
}

$(document).ready(function(){
    $(document).bind("keydown", disable_f5);    
});
+8
source

Unable to disable these browser features. Would you like a page to disable your F5 key? I doubt it. If you are trying to implement some kind of protection here, I suggest checking the correct approaches to server-side validation.

+2
source
+2
source

All Articles