Currently I have a requirement to disable the functionality of refresh button in all browsers. I can do that for F5 button but for the refresh button I didn’t get any idea. even i googled this. I didn’t get any ideas. Please help me in this. This requirement is needed for security purpose, because my application has URL change activities on some scenarios.
For f5 i am trying like this,
function checkKeyCode()
{
switch (event.keyCode)
{
case 116 : // 'F5'
event.returnValue = false;
event.keyCode = 0;
window.status = "We have disabled F5";
break;
}
}
The short answer is that you can’t do this, not without some kind of weird plugin you want the user to install.
The browser is a runtime environment that reads your HTML files and executes what are in them. So, as far as you can intercept keystrokes in the HTML document, you still won’t be able to stop the browser from refreshing as that is a client-side action you have no control over.
The closest to a solution you will get is to use cookies or some Javascript to intercept the fact that the page has been refreshed, then you can deal with it in your web application.