Disabling the right click on web page using javascript


This code will disable right click on page. This code will disable Copy and paste functionality of the windows. Use this code in Head tag in HTML document. With the help of this code you can prevent your web page content for copy and paste functionality. How to use the code for copy and paste disabling.

How to disable the right click on web page using javascript


The following code will disable the right click on page, this code will disable Copy and paste functionality of the windows. Use this code in Head tag in HTML document, with the help of this code you can prevent your web page content for copy and paste functionality. Now, you are aware how to use the code for copy and paste disabling with the help of javascript.

This code is also helpful to prevent to open View Source of the page.


<Head>
<script language="javascript" type="text/javascript">

var popup = "Sorry, right-click is disabled.";
function noway(go) {
if (document.all) {
if (event.button == 2) {
alert(popup);
return false;
}
}
if (document.layers) {
if (go.which == 3) {
alert(popup);
return false;
}
}
}

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

document.onmousedown = noway;
</script>
</Head>


Comments

Guest Author: sunita17 Apr 2012

Not working .............

Guest Author: Kinjal29 Jun 2012

yupe, its good n also working..
Thnx....

Guest Author: suresh15 Oct 2012

not working



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: