0

Hi I have the following code for disabling F5

$(document).ready(function(){

 $(window).keydown(function(event){
 if(event.keyCode == 116)
 {
 event.preventDefault();
 return false;
 }
 });

});

But i am unable to resolve to prevent the browser reload.

I am trying to find the solution for disabling the browser reload. And learn in the process.

Mahi
  • 553
  • 2
  • 7
  • 23
  • 1
    See this post : https://stackoverflow.com/questions/2482059/disable-f5-and-browser-refresh-using-javascript – Shahzaib Jul 14 '22 at 06:54
  • Does this answer your question? [Disable F5 and browser refresh using JavaScript](https://stackoverflow.com/questions/2482059/disable-f5-and-browser-refresh-using-javascript) – Luciano Barreto Jul 14 '22 at 07:00
  • @LucianoBarreto : I tried using the link but I am not able to find the solution to prevent browser reload that is when a user tries to click on browser reload icon, the page shouldn't reload . I tried implementing to prevent refresh when clicked on F5 , ctrl+R and right click. But I am not able to find the solution for preventing browser reload when clicked on reload icon in the browser. – Mahi Jul 14 '22 at 07:44
  • @Shahzaib : I tried using the link but I am not able to find the solution to prevent browser reload that is when a user tries to click on browser reload icon, the page shouldn't reload . I tried implementing to prevent refresh when clicked on F5 , ctrl+R and right click. But I am not able to find the solution for preventing browser reload when clicked on reload icon in the browser. – Mahi Jul 14 '22 at 07:45
  • I would be really surprised if there was a reliable solution for that.. since that's the browser domain and you shouldn't have such a far control over it. You can invent workarounds but you won't never fully get there (as long as I can say) unless you force the client to be a sort of kiosk mode terminal.. but that's out of your control when just serving the page. There are of course exceptions if you need it to warn the user before they loose form edited contents https://stackoverflow.com/questions/3527041/prevent-any-form-of-page-refresh-using-jquery-javascript – Diego D Jul 14 '22 at 08:59
  • @DiegoDeVita : I have Implemented to restrict the user use F5 , Right click and Ctrl+R but am not able to find the solution for disabling the browser reload. Is there any way to disable the browser navigation bar so that the user only sees the page content and not able to see the browser navigation bar. – Mahi Jul 15 '22 at 10:31

0 Answers0