Volleynerd Knowledge Base

Thursday, October 02, 2003


Disable Right Click in Browser

Thanks to Charles for showing me the light.
<script>


isNN = document.layers ? 1 : 0;

function noContext(){return false;}

function noContextKey(e) {
if(isNN){
if (e.keyCode == 96){ return (false);}
} else {
if (event.keyCode == 96){ return (false);}
}
}

function noClick(e){
if(isNN){
if(e.which > 1) {return false;}
} else {
if(event.button > 1){return false;}
}
}

if(isNN){
document.captureEvents(Event.MOUSEDOWN);
}

document.oncontextmenu = noContext;
document.onkeypress = noContextKey;
document.onmousedown = noClick;
document.onmouseup = noClick;

</script>




Comments: Post a Comment

Home