This is a scriptlet I found in the web. I guess these would be pretty useful in the Ajax context.
/*****
// Suppress Keys (Back Space) - Start
window.history.forward(1);
function _suppressKeyPress()
{
//alert(event.keyCode);
/*Key Codes
112 -> F11
8 ->
Backspace
116 -> F5
115 -> F4
93 -> Windows Properties Key
17 -> CTRL
*/
//======================================================
// Disable CTRL
Key
//======================================================
keys = new
Array();
keys["f17"] = 'Ctrl';
keys["f8"] = 'Backspace';
saveCode=""
if(window.event && window.event.keyCode == 17)
{
saveCode=window.event.keyCode;
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 505)
{
alert('Ctrl has been disabled');
return false;
}
//======================================================
// Disable
Backspace Key
//======================================================
if(window.event && window.event.keyCode == 8
&& !window.document.activeElement.isTextEdit)
{
saveCode=window.event.keyCode;
window.event.keyCode = 506;
}
if(window.event && window.event.keyCode == 506)
{
//alert('Backspace has been disabled');
return false;
}
//======================================================
// Disable F5
Key
//======================================================
if(window.event && window.event.keyCode == 116 )
{
saveCode=window.event.keyCode;
window.event.keyCode = 507;
}
if(window.event && window.event.keyCode == 507)
{
alert('F5
has been disabled');
return false;
}
//======================================================
if(event.keyCode == 122 event.keyCode == 115 event.keyCode == 93)
{
event.keyCode = 0;
event.returnValue = false;
}
}
//------------------------------------------------------------------
//
Capture Key Press event & call the function to suppress the event
//------------------------------------------------------------------
window.document.onkeydown = _suppressKeyPress;
//-----------------------------------------------------------
//
Suppress Right click - Start
//-----------------------------------------------------------
var
message="VFS";
function click (e)
{
if (document.all)
{
if
(event.button ==2event.button==3)
{ alert("Access Denied");
return
false;
} }
if (document.layers)
{
if (e.which == 3)
{
alert(message); return false;
} } }
if (document.layers)
{
document.captureEvents(Event.mousedown);
}
// Capture Right click
event & call the function to suppress the event
document.onmousedown=click;
//-----------------------------------------------------------
*//////
// Suppress Keys (Back Space) - Start
window.history.forward(1);
function _suppressKeyPress()
{
//alert(event.keyCode);
/*Key Codes
112 -> F11
8 -> Backspace
116 -> F5
115 -> F4
93 -> Windows Properties Key
17 -> CTRL
*/
//======================================================
// Disable CTRL Key
//======================================================
keys = new Array();
keys["f17"] = 'Ctrl';
keys["f8"] = 'Backspace';
saveCode=""
if(window.event && window.event.keyCode == 17)
{
saveCode=window.event.keyCode;
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 505)
{
alert('Ctrl has been disabled');
return false;
}
//======================================================
// Disable Backspace Key
//======================================================
if(window.event && window.event.keyCode == 8 && !window.document.activeElement.isTextEdit)
{
saveCode=window.event.keyCode;
window.event.keyCode = 506;
}
if(window.event && window.event.keyCode == 506)
{
//alert('Backspace has been disabled');
return false;
}
//======================================================
// Disable F5 Key
//======================================================
if(window.event && window.event.keyCode == 116 )
{
saveCode=window.event.keyCode;
window.event.keyCode = 507;
}
if(window.event && window.event.keyCode == 507)
{
alert('F5 has been disabled');
return false;
}
//======================================================
if(event.keyCode == 122 event.keyCode == 115 event.keyCode == 93)
{
event.keyCode = 0;
event.returnValue = false;
}
}
//------------------------------------------------------------------
// Capture Key Press event & call the function to suppress the event
//------------------------------------------------------------------
window.document.onkeydown = _suppressKeyPress;
//-----------------------------------------------------------
// Suppress Right click - Start
//-----------------------------------------------------------
var message="VFS";
function click (e)
{
if (document.all)
{
if (event.button ==2event.button==3)
{ alert("Access Denied");
return false;
} }
if (document.layers)
{
if (e.which == 3)
{ alert(message); return false;
} } }
if (document.layers)
{
document.captureEvents(Event.mousedown);
}
// Capture Right click event & call the function to suppress the event
document.onmousedown=click;
//-----------------------------------------------------------



gduigdgg
HDU8YHEWYHHWJHDUGUDSSJDHUHGSDUHU;SHUSDHUA
thank you…. great script
—-
Fortes
escalando.net
Oh, and did not know about it. Thanks for the information …
Hi folk,
Thats really nice… Thaks a lot for the code.
Thanks,
Senthur.
Hi, I have a little problem and came across your website as I was trying to look for answers. I’m not a programmer, so I don’t know how to read codes, but find this code of yours I think is close to what I was looking for. Basically what I need is to disable hotkeys of firefox.
Alt F for File
Alt E for Edit
Alt V for View
Alt S for History
Alt B for Bookmarks
Alt Y for Yahoo
Alt T for Tools
Alt H for Help
Ctrl W
I don’t mean to impose, but I have searched all over and have asked people and still couldn’t find the solution to this problem. I was wondering if you might be able to help me in this. Your feedback is very much appreciated and I look forward to hearing from you
Many thanks
Amy from the Philippines
he’lo
check out this script for disable keys
works for safari, mozilla & ofcourse in IE ……
just add key_code in if() u want to disable
function disableKeys(e)
{
// get key code
var key_code = (window.event) ? event.keyCode : e.which;
var ctrl_key = (window.event) ? event.ctrlKey : e.ctrlKey;
// case : if key is enter or escape or F5 or ctrl+n or ctrl+r then avoid it
if ( key_code==13 || key_code==27 || key_code==116 || ctrl_key && (key_code == 78 || key_code == 82) )
{
// case :if it is IE event
if (window.event)
{
window.event.returnValue = null;
event.keyCode=0;
}
// case: if it is firefox event
else
e.preventDefault();
}
}
I am using a pdf control on my page and I want to disable the toolbar of that control, does any one has the solution?
If yes so please post as soon as possible.
And I just want to disable all the browser functions like Refresh button, back and forward buttons etc.
Looking for prompt response.
Thanks and Regards.
Those buttons belong to user. U can’t disable it.
If in IE u can use:
window.history.forward();
is it support to other browser? i.e. NN, Safari, Opera, Chrome.
Sori about my English.