Preventing mirroring

---------

Elliotte Rusty Harold (elharo@shock.njit.edu)
Tue, 11 Mar 1997 09:13:01 -0400


In light of the recent thread on framing pages and such, I thought readers
of this list might be interested in the following simple JavaScript I
whipped up this morning for my pages. Adjust the sitename accordingly,
place it in the header of your pages, and when someone views an illegally
mirrored copy of your page, they'll be transparently bounced back to the
proper site, at least if they have JavaScript.

<SCRIPT LANGUAGE=JAVASCRIPT>
/* Only sunsites are allowed to mirror this page and then
only with explicit, prior permission. For details,
send email to elharo@sunsite.unc.edu */
if (location.protocol.toLowerCase().indexOf("file") != 0 ) {
if (location.host.toLowerCase().indexOf("sunsite") < 0) {
location.href="http://sunsite.unc.edu/javafaq/";
}
}
</SCRIPT>

This is the first JavaScript I ever wrote, so if you have comments or
suggestions, please let me know. Also, please feel free to modify or reuse
this as you please.

This script won't stop an intelligent thief who knows they're a thief.
However, it should prevent the "I didn't know this was copyrighted" or "I
thought you wouldn't mind if I copied your work" defenses. Once this
script is included on your web page, copiers will know that you don't allow
what they're doing.

I got the idea for this script after my latest Altavista search for illegal
mirror copies of one of my FAQ lists turned up over 30 hits around the
world. I originally implemented this as a Java applet, but that was
problematic since it might cause a user who was just browsing a locally
cached copy (which I allow) to dial out to the Inetrnet unexpectedly to
load the applet. This JavaScript has the advantage of running completely
on the client.

--
Elliotte Rusty Harold          Author of Java Network Programming
Available now from O'Reilly!   Order from Amazon:
<http://www.amazon.com/exec/obidos/ISBN%3D1565922271/cafeaulaitA/>
elharo@sunsite.unc.edu  http://sunsite.unc.edu/javafaq/


[ Usenet Hypertext FAQ Archive | Search Mail Archive | Authors | Usenet ]
[ 1993 | 1994 | 1995 | 1996 | 1997 ]

---------

faq-admin@landfield.com

© Copyright The Landfield Group, 1997
All rights reserved