Sponsors

Tuesday, July 13, 2010

How to disable user from right click on webpage

Here is the extract of the code which does it.
<script type="text/javascript">

function md(e)
{
try { if (event.button==2||event.button==3) return false; }
catch (e) { if (e.which == 3) return false; }
}
document.oncontextmenu = function() { return false; }
document.ondragstart = function() { return false; }
document.onmousedown = md;

</script>

1 comment: