Disable right click with Javascript

Here is two javascript code, helps you to disable right click, on webpages with Javascript.

function NoRightClick() {
if (event.button == 2)
{
alert("This action is not possible")
}
}
document.onmousedown=NoRightClick;

Or you can simply use.

<body oncontextmenu="return(false);">

This second code works only in Microsoft Internet Explorer.

No related content found.

This entry was posted in Javascript and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>