While looking at my logs the other day, I noticed a lot of extra traffic from an external source for one of my sites, unsure of what it was I went to look. The owner of the other site had wrapped my site in an iframe, and covered it in adverts of his or her own making my site look awful. This I wasn’t happy with, but without any access to the site in question, I couldn’t change what the person was doing.
My site doesn’t use iframes at all, so I knew I could safely put a little bit of code into every page to make a quick test when the page loads to see if it is the ‘top’ level page, if it is nested at all then we can pop it out of the nesting.
if (top != self)
top.location.href = self.location.href
This is a simple test, if the url of the top level page is not the same as the current elements url, update the top level page to be that of the frame and bust us out of the iframe.
A simple solution, to an annoying problem that shouldn’t exist – the blatant theft of content.
Be First to Comment