I have this script:
window.onload = function(){
document.getElementById('workspace').oncontextmenu = function(){
return false;
}
}
function click(e) {
if (navigator.appName == 'Netscape' && e.which == 3) {
window.location.reload();
return false;
else {
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2)
window.location.reload();
return false;
}
return true;
}
document.onmousedown=click;
The workspace is id of my <body> element. Basically this script does is, it reloads the current page when right clicked on the page. I’m happy with it, this is all I want.
But this script is having a bug. The problem is the left click is disabled. I have some text on webpage but the you can select the text with this script enabled.
I have no much experience with JavaScript but I tried removing the last line of the script. When I did so the left click started working and I can select the text, but soon I noted that reload does not works.
It could be because of click function
return falsein the third line.you need
}beforeelse {and need to wrap with{}for lastifblock.something like this should be ok.