Call this function on the
onKeyDown
event:
document.onkeydown = function(e) {
if (e.keyCode === 116) {
return false;
}
if (e.keyCode === 8) {
return false;
}
};
This will prevent from
F5 reload
and
backspace back
.
Ref.:Disable F5[^]
Also have look for alternatives:
Can the F5 key be disabled [
^]
Here you can find example using
javaScript
:
Disable browser F5 Key[
^]