Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

protecting with no right clicking 3

Status
Not open for further replies.

perlone

Programmer
May 20, 2001
438
US
I want to avoid the right clicking without those annoying alert box. Is there any way to do that? ----------------------------------------
There is no Knowledge, That is not power.

Yes, i'm a SQL Newbie.
-Aaron
----------------------------------------
 
Try this:
Code:
<script language=&quot;JavaScript1.2&quot;> 
if (window.Event) 
document.captureEvents(Event.MOUSEUP); 
function nocontextmenu() 
{ 
event.cancelBubble = true 
event.returnValue = false; 
return false; 
} 
function norightclick(e) 
{ 
if (window.Event) 
{ 
if (e.which == 2 || e.which == 3) 
return false; 
} 
else 
if (event.button == 2 || event.button == 3) 
{ 
event.cancelBubble = true 
event.returnValue = false; 
return false; 
} 
} 
if (document.layers) { 
document.captureEvents(Event.MOUSEDOWN); 
} 
document.oncontextmenu = nocontextmenu; 
document.onmousedown = norightclick; 
document.onmouseup = norightclick; 
//--> 
</script>
*I was just recently working on some source protection stuff if you'd like to email me.* -gerrygerry
geraldschafer@hotmail.com
 
Thanks, it does work but does this work with all browsers or just IE? ----------------------------------------
There is no Knowledge, That is not power.

Yes, i'm a SQL Newbie.
-Aaron
----------------------------------------
 
Hi,

I just tried it in IE 5.5 and Netscpe 6 and it seems to work in both of those but, if someone wants to get whatever you are trying to hide, they will so what is the point of trying?

I`ve got a custom right click menu on the site I have just built but that is mostly for navigation purposes.

Morale of the story? You are not going to stop someone from getting your source code with a non right click code. Fair enough, it might take longer but a lot of people will try harder because you have stopped them right clicking.


Wullie

 
i already wrote a program in perl that might just avoid these. It's for some images i have it on my site but i already got the copyrght but i want protect from people who really don't pay attention to the copyright. ----------------------------------------
There is no Knowledge, That is not power.

Yes, i'm a SQL Newbie.
-Aaron
----------------------------------------
 
ok, thanks i'll will try that. ----------------------------------------
There is no Knowledge, That is not power.

Yes, i'm a SQL Newbie.
-Aaron
----------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top