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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop Coying of my site

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Does anyone know how to stop people copying a websites contents? i.e disable to right hand click on a mouse when they arrive at my site.....
 
There are loads of no-right-click scripts but they won't stop people from viewing your source (which I assume is what you mean by "copying my site") as there are a number of ways to do it apart from right click.
 
Yes, use server side code instead of client side.

There is no reliable way to prevent someone from stealing your code if you rely primarily on client side scripting. This is true for preventing people from 'stealing' your design as well. Javascript has a lot of handy properties you can use to remove the toolbar, etc, however, if the user has java turned off, it won't make any difference. You Jscript won't do a thing.

Server side is parsed by the server before it's sent to the client so they can only view the result, not the code it takes to achieve the result.

"It's easier to ask forgiveness than it is to get permission." - Rear Admiral Dr. Grace Hopper
 
Actually I just need the script to stop the right click, not worried about the source code being copied. Can you direct me somewhere where I can pick this code up. :)
 
<SCRIPT LANGUAGE=&quot;JavaScript1.1&quot;>

<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert(&quot;Sorry, you do not have permission to right click.&quot;);
return false;
}
return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
// End -->
</script> &quot;It's easier to ask forgiveness than it is to get permission.&quot; - Rear Admiral Dr. Grace Hopper
 
Instead of just disabling the right click menu, how about putting in your OWN custom naviagtion menu?
Cheers,
Jim
iamcan.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top