Geocities Webpage Creator (HTML)/Photo security

Advertisement


Question
I was wondering if you could tell me how to keep people from right-clicking on my photos and copying them for their own use.
What do I need to do to stop this?

Thanks for your help.
Heather

Answer
Put this code between your <head></head> commands:

<SCRIPT language="JavaScript">
<!--
var sorry="Sorry, right-click is disabled."

function click(e) {
if (document.all) {
if (event.button == 2) {
alert(sorry);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(sorry);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// -->
</SCRIPT>

There is a catch however.  This code only works in Internet Explorer (Netscape doesn't support any sort of right-click disabling code).

-Katie

Geocities Webpage Creator (HTML)

All Answers


Ask Experts

Volunteer


Katie Bischoff

Expertise

I have been making webpages for 5 years. I have worked with everything from Geocities to Dencity to CuteHTML. I can answer almost any question you have, be it about programming in general or different programs to use.

Experience

I have been making websites for 5+ years, and I currently run 10 different sites. I went from having a site on Geocities to having my own domain, and in the process I've used quite a few different programs to ccomplish what I wanted.

©2012 About.com, a part of The New York Times Company. All rights reserved.