Forum Moderators: phranque

Message Too Old, No Replies

Site being framed.

site being framed

         

hakanhaknuz

7:21 pm on Mar 19, 2007 (gmt 0)

10+ Year Member



My site is being framed by another website..
Is it safe to use this
<body onLoad="if (self!= top) top.location = self.location">
or this:

<script type="text/javascript" language="JavaScript"><!--
if (self!= top)
{
if (document.images)
top.location.replace(window.location.href);
else
top.location.href = window.location.href;
}
// --></script>

To prevent this kind of action?
Or will it hurt my sites SEO wise?
Anybody any experience, i am in a hurry to implement this code and find out what will happen.

physics

7:34 pm on Mar 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That code should be fine to put in your pages. The spiders will ignore the javascript but it will keep your site from being framed (make sure to test it).

hakanhaknuz

7:35 pm on Mar 19, 2007 (gmt 0)

10+ Year Member



Thank you for your reply.
I can be clearer, the above codes didn't work.
What is happening is another site uses a link like this:

[anothersite...]

The result(mysite) is shown with their toolbar at the top and within their frames.
This is kind of like the netdisaster thingy.
What should i do, seo wise to prevent this?

jomaxx

8:12 pm on Mar 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you actually view the frame itself to make sure it your actual site being displayed? They could be proxying your site instead. In that case, the best solution is to determine the proxy's IP address and block it.

Also keep in mind that you may need to do a shift-reload, in order to force your browser to re-fetch the page code if it's been changed.

hakanhaknuz

8:52 pm on Mar 19, 2007 (gmt 0)

10+ Year Member



Did you actually view the frame itself to make sure it your actual site being displayed? They could be proxying your site instead. In that case, the best solution is to determine the proxy's IP address and block it.

>>I guess you mean "caching with a proxy server" when you say "proxying" or am i wrong?
No i guess that wasn't the case.

Also keep in mind that you may need to do a shift-reload, in order to force your browser to re-fetch the page code if it's been changed.

>>You reminded me about the caching feature enabled on my website. Thanks! I deleted the cached page. That was indeed the reason.
Now my website refreshes, but unfortunately my website will be completely loaded in their page before the refreshing takes place.

Wich one would you prefer of the above codes or are there better ones available, like a php solution?

hakanhaknuz

9:50 pm on Mar 19, 2007 (gmt 0)

10+ Year Member



Ok this code is really quick, i have put it in my header and it seems to work great!

<script>
if (window!= top)
top.location.href=location.href
// -->
</script>

Does anybody see a downfall or has a better solution, please let me know.

jezra

9:52 pm on Mar 19, 2007 (gmt 0)

10+ Year Member



It is possible for the framing site to disable your ability to break out of their frames using javascript. Your best option would be to find the IP address of the framing site and use either .htaccess or some sort of server side script to block the IP address when it is the referrer.

hakanhaknuz

10:11 pm on Mar 19, 2007 (gmt 0)

10+ Year Member



Ok..that is a problem. ..
Off course i can block this one site but...
I am definately looking for a more general and common approach for preventing this kind of thing happening, by pure luck i discovered this site. I cannot simply wait for me to find out other ip's that play the same game and ban their ip addresses.

I need a piece of code that does the trick for any foreign framing site, wich cannot be blocked by that same framing site...

jomaxx

10:16 pm on Mar 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is possible for the framing site to disable your ability to break out of their frames using javascript. Your best option would be to find the IP address of the framing site and use either .htaccess or some sort of server side script to block the IP address when it is the referrer.

Jezra: Are you sure the framing site can block a break-out-of-frames script? I've never heard of this except in the case that, as I mentioned earlier, it's acting as a proxy.

P.S. The IP address of the framing site is irrelevant unless, again, it's acting as a proxy.

jezra

5:59 pm on Mar 20, 2007 (gmt 0)

10+ Year Member



if I remember correctly, the framing site that I had to deal with put a small piece of horribly invalid javascript after the frameset code. This pretty much stopped all javascript parsing from that point on and my break out of frames script never ran.

londrum

9:43 pm on Mar 25, 2007 (gmt 0)

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



why waste the free traffic? can't you just do something similar to what you do when people steal your images?
if you can identify the referrer, then you should be able to replace the page he wants with another one. you can still let him frame it, but just do a blank page with a link back to your site.
that way you get to keep all the traffic he's giving you.
once he notices, he'll take it down.