Forum Moderators: phranque

Message Too Old, No Replies

Better code to stop casual swiping

And break any frames

         

Angonasec

9:57 am on Jun 8, 2006 (gmt 0)



I'm setting up new site.

What is the best code to stop casual copying of the page and images, and break any frames linkers try to put on our content?

I've been using this form successfully, but wonder if there's something better to cope with new browsers:

<script language="JavaScript" type="text/javascript">
<!--
function framebreakout()
{
if (top.location!= location) {
top.location.href = document.location.href ;
}
}
//-->
</script>
<meta http-equiv="imagetoolbar" content="no"></HEAD><BODY onload="framebreakout()" oncontextmenu="return false" ondragstart="return false" onselectstart="return false">

And in passing; does using this base ref on a page stop frames being put on it by sites who link to the page?

<BASE href="http://www.example.com/">

Ta

Angonasec

3:40 pm on Jun 9, 2006 (gmt 0)



"Swiping" means stealing, in case my slang has foxed you all.

What's the best method to use to stop it?

Ta!

ergophobe

5:36 pm on Jun 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well, obviously you can't really, so like you say, it's a matter of stopping the casual thief (who probably doesn't even think of themselves as a thief).

Things you can do that make things a tiny bit more difficult.

- check the referer. If it's not your site, don't serve up images
- create a honeypot to catch page scrapers

Angonasec

6:41 pm on Jun 9, 2006 (gmt 0)



I don't want to go that far, I'm just wondering if there's better code than what I posted above. It's a coupla years old and browsers have moved on.

We both know how easily it is circumvented, but it certainly stops the IE bozos. I know, because I read their ALLCAPS rants :)

Angonasec

12:45 am on Jun 12, 2006 (gmt 0)



It seems Y! images now overules all JS frame breakers.

So we really need a better script than this...

encyclo

1:02 am on Jun 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I use this in a script block defined in the document head:

if (top!= self) top.location.replace(self.location.href);

You don't need an

onload
event for this script.

Of course, with the previously-discussed [webmasterworld.com] Yahoo images problem there is not a lot you can do client-side as Javascript is forcibly disabled (in IE only).

Angonasec

12:25 pm on Jun 12, 2006 (gmt 0)



What would be an example full java script code for that please?

I blocked Y! images in robots.txt last week.