PDA

View Full Version : Ctrl+R ?


Alias
06-21-2002, 09:25 PM
How to disable pressing of keyboard shortcut Ctrl+R ?

User is in occasion to refresh page with RIGHT CLICK -> REFRESH,
but I need to disable pressing of keys Ctrl+R.


Possible?

Regards

x_goose_x
06-21-2002, 09:44 PM
Don't forget about F5.

jkd
06-21-2002, 10:50 PM
Originally posted by x_goose_x
Don't forget about F5.

Bah, only for Windows users. ;)

Personally, I dislike any site which attempts to disable any keyboard or mouse action related to the GUI.

To do it though, maybe something like:

document.onkeydown = document.onkeypress = document.onkeyup = function(evt) {
var event = evt || window.event;
if (String.fromCharCode(event.which || event.keyCode).toLowerCase() == 'r' && event.ctrlKey) {
if (typeof event.stopPropagation != 'undefined') {
event.stopPropagation();
event.preventDefault();
}
else {
event.returnValue = false;
event.cancelBubble = true;
}
}
}

No guarentees though.

whammy
06-22-2002, 01:18 AM
And, if that works, good luck trying to see your new version of the page when you've made any update... ;)

Alias
06-22-2002, 12:01 PM
thanx friends !!!

thanx for all comments. very usefull.

"Personally, I dislike any site which attempts to disable any keyboard or mouse action related to the GUI."
... this comment is OK - me too - but I need this because of visitors.... but it is hard to explain very complicated problem ... and this is one way of solution ...

once again - thanx

best regards ;)