Disabling right click
on webpages using javascript:
We can stop users
right click on web pages.here is a simple
javascript code to avoid right click by users.
<script language="javascript">
document.onmousedown=disableclick;
message="Right Click not enabled";
Function disableclick(event)
{
if(event.button==2)
{
alert(message);
return false;
}
}
</script>
and
<body oncontextmenu="return false">
...
</body>
The above code will avoid showing context menu when a user
right click on it.
No comments:
Post a Comment