Forum Moderators: DixonJones

Message Too Old, No Replies

can I use htaccess to block a referring site?

site in question displays my site in a frame

         

microcars

6:45 pm on Sep 2, 2004 (gmt 0)

10+ Year Member



and it shows up as a Referring site.

this is in violation of the copyright statement posted on this particular website, you can link to it, but you cannot display it in a "frame" so it appears to be part of another site.

the referring site is registered in TURKEY but oddly enough the IP address that it resolves to is a TEXAS USA company.

I already use htaccess to block hotlinking of images, can I also do something to prevent this site from being displayed in a frame on another site?

references to other threads are welcome.
or maybe I just forget about this and move on....

digitalv

6:47 pm on Sep 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nothing I'm aware of, but you can cause any links on your site to make the visitor "break out" of frames. Just make all of your links do a TARGET="_TOP"

That way if they click a link on your site they'll be frame-free.

microcars

6:51 pm on Sep 2, 2004 (gmt 0)

10+ Year Member



ah, thank you, that will help.

a bit o work, but maybe a global find and replace will do the trick.

The Contractor

6:54 pm on Sep 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This will help with users:

<SCRIPT language="JavaScript">
<!--
if (top.frames.length > 0)
{
top.location=self.location;
}
//-->
</SCRIPT>

jdMorgan

7:18 pm on Sep 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've been using the following to avoid breaking (and do a fix-up) on the browser history:

<script language="JavaScript" type="text/JavaScript">if (parent.frames.length > 0) top.location.replace(document.location);</script>

Jim

microcars

7:20 pm on Sep 2, 2004 (gmt 0)

10+ Year Member



interesting, the _top command does not work with Safari (or at least ver 1.03, but it does work with IE and Firefox.

I tried the javascript bit and it works great with Firefox, but nothing on IE or Safari.

(note I am not testing this with Windows ver of IE, perhaps the javascript works in Windows versions...)

Thanks so much for the help and tips!

dcrombie

10:08 am on Sep 3, 2004 (gmt 0)



AFAIK this works in all JavaScript browsers:

<HEAD> 
...
<SCRIPT type="text/javascript">
if(self!= top) top.location.href = self.location.href;
</SCRIPT>
...
</HEAD>