I want to disable or override the default help function of browsers.
I tried to look at few examples online but they are not working for me.
(The following code is working on Firefox and Chrome but not on Opera and IE)
<html>
<title>
</title>
<body>
<script src = "jquery-1.7.1.min.js" text="type="text/javascript""></script>
<script language="javascript" type="text/javascript">
document.onkeydown = function(event)
{
if(window.event && window.event.keyCode == 112)
{
event.stopPropagation();
event.preventDefault();
event.keyCode = 0;
return false;
//document.onhelp = new Function("return false;");
//window.onhelp = new Function("return false;");
//helpFunction();
}
else if(event.which == 112)
{
helpFunction();
}
};
var false_function = new function(){"return false";};
shortcut.add("f1",false_function);
var helpFunction = function() {
alert('help');
}
</script>
<h2>Test</h2>
</body>
I’ve found here this code that was clamied to work in each version of IE and FF
Working JSFiddle. Note that you have to test it after clicking the result tab.