Prevent Refresh (disable the F5 key )

“<body onkeydown=”PreventRefresh(event)”></body >”

function PreventRefresh(e) {
var key;//IE
if(window.event){
key = window.event.keyCode;
if (key == 116){//keycode for F5 function
e.keyCode = 0;e.returnValue = false;
e.cancelBubble = true;
return false;
}
}
//firefox
else{
key = e.which;
if (key == 116){
e.stopPropagation();
e.preventDefault();
return false;
}
}
}

More about events in javascript: Introduction to Events

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s