|
|
|
 
|
Prevent right clicking.
You have worked so hard on writing these scripts only to find out that dozens of people have copied your script?
Then include one of these scripts to make it a bit harder to copy.
<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>
or
<script language="JavaScript"><!--
//stops both right- and left-click function
//downloaded from webmaster2020.com
function right(mousebutton)
{
var msg1 = "Hey!! Look but don't touch!";
var msg2 = "Don't click here either!";
if (navigator.appName == 'Netscape' && mousebutton.which==3)
{
alert(msg1);
return false;
}
else
if (navigator.appName == 'Netscape' && mousebutton.which==1)
{
alert(msg2);
return false;
}
else
if (navigator.appName == 'Microsoft Internet Explorer' && event.button == 1)
{
alert(msg1);
return false;
}
else
if (navigator.appName == 'Microsoft Internet Explorer' && event.button == 2)
{
alert(msg2);
return false;
}
return true;
}
document.onmousedown = right;
//--></script>
Note : They still can see your source code through VIEW->SOURCE.
If you really want to protect your scripts, write it in PHP, ASP or CGI (server-side script).
In cooperation with SecurityHome.eu
TOP
|
|