Home / code / shell / scripts

Right-clicking

Writer: Christophe Wolfs
Published: 27 March 2008

This is a small script that prevents right clicking.
Note : They still can see your source code through VIEW->SOURCE.

<script language=JavaScript><!--
//stops right-click function
//downloaded from webmaster2020.com

var message="No Right Click";
function click(e)
{
  if (document.all)
  {
        if (event.button == 2)
        {
          alert(message);
          return false;
        }
  }
  if (document.layers)
  {
        if (e.which == 3)
        {
          alert(message);
          return false;
        }
  }
}
if (document.layers)
{
  document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// --></script>

 

TOP