refresh the page
Moderator: General Moderators
refresh the page
how to restrict the user from refreshing the page
You can block the F5 key with the following code:
[Note - you have to call this function like so: <tag onkeydown="kill_page_refresh();">]
Only tested on IE though.
[Note - you have to call this function like so: <tag onkeydown="kill_page_refresh();">]
Code: Select all
/**
* Disables page refreshing.
*/
function kill_page_refresh(e) {
if (window.event) {
if (event.keyCode==116||(event.keyCode==82&&event.ctrlKey)) {
event.returnValue = false;
event.keyCode = 20;
}
}
return true;
}That leaves shift-f5, clicking the refresh button in the browser, right-clicking, and of course any plugins the user might have.foobar wrote:You can block the F5 key with the following code
You can't, and you shouldn't. Doing so removes functionality from users that they may need.rajan wrote:how to restrict the user from refreshing the page
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
I thought a simple window.unload will do this job but i noticed the side-effect will be user not able to navigate to other page or close the window
had not IE implemented a confirm box to ask the user - "Are you sure you want to navigate away from this page". Brrrrr.... I would have locked myself in 