Forum Moderators: martinibuster

Message Too Old, No Replies

Disabling AdSense if page is framed

         

zerillos

7:20 pm on Dec 22, 2011 (gmt 0)

10+ Year Member Top Contributors Of The Month



Is there a way to NOT load the adsense code on a particular page in case I detect the page is being displayed in an iframe? I'm really not comfortable with people framing my pages, especially when it results in my adsense code being displayed on 3rd party websites. (That "allowed sites" option in WMT doesn't solve the issue, because the adsense code is essnetially loaded by my page, and not the framing window.)

I was thinking something in the lines of wrapping the adsense code like this (since we're not allowed to modify the actual AdSense code...)

if (top==self) {
AdSense Code
}

thanks!

jetteroheller

2:56 pm on Dec 27, 2011 (gmt 0)

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



The usual frame break out code

if(top.location!=location){top.location.href=location.href}

zerillos

12:56 am on Dec 28, 2011 (gmt 0)

10+ Year Member Top Contributors Of The Month



That doesn't always work, unfortunately.

jetteroheller

7:26 am on Dec 29, 2011 (gmt 0)

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



I have no idea, where this does not work.

When javascript is turned off, also AdSense does not show up.

zerillos

1:04 am on Dec 30, 2011 (gmt 0)

10+ Year Member Top Contributors Of The Month



It depends a lot on browser, browser version and on the type of frame buster buster code the website uses. But that's not the point of my question, since frame busting doesn't really have a solution for all situations.

I'm looking for a way to not load the adsense code if the page is displayed in an iframe. Since i was not able to figure out a server side method, i guess javascript is the way to go.

The "if" approach i mentioned above looks pretty straight forward to me, however, i can't seem to figure out an implementation (i'm not a javascript guru unfortunately) .

IanCP

6:53 am on Dec 30, 2011 (gmt 0)

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



Well having thought about it for several days, if JS frame buster doesn't work you're SOL [sorry out of luck].

Yes, in Firefox I use "NOSCRIPT" because I became sick of newspaper sites I visit consuming my bandwidth. I don't mind a fair thing but processing Video Clips, DoubleClick, FaceBook etc. etc. doesn't enhance my surfing experience.

About 12 years ago, on another forum, a copyright lawyer proffered advice about having a "Copying" page on our sites regarding copyrights. Good advice for its time.

Unfortunately the United Arab Emirates and Sultanate of Oman don't accept my long standing claims for $280 million and $360 million respectively for breach of intellectual property. Both have long time absorbed my sites into their official college lectures. My Australian government doesn't want to know about it for fear of giving offence.

I'm almost certain [yes I could look at my own but I'm too lazy] that framing pages fell within breach of copyright.

Go after them for that. If you can.

zerillos

8:21 am on Dec 30, 2011 (gmt 0)

10+ Year Member Top Contributors Of The Month



In my opinion framing should be considered copyright infringement, but i'm not really sure it currently is. Unfortunately, i don't have the means to do legal battle with the sites that frame me, so i have to find ways around it.

jetteroheller

8:54 am on Dec 30, 2011 (gmt 0)

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



BTW, if You have identified an offender, there are nice tricks with
.htaccess

Once, an English real estate company hotlinked a photo from a villa in spain direct from my site.

I put some lines in the htaccess.
if referer is english real estate company
sent photo from the most terrible doghouse, I have ever seen.

IanCP

7:31 pm on Dec 30, 2011 (gmt 0)

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



Ah I had one hotlinking once. I simply changed the name of the .jpg file and the html and then I modified the old .jpg with bold large red font across saying "THIS IMAGE STOLEN FROM..."

IanCP

7:34 pm on Dec 30, 2011 (gmt 0)

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



I put some lines in the htaccess

Good move! The mind boggles with mischievous opportunities.

Lectures on the evils of framing?

jetteroheller

8:50 pm on Dec 30, 2011 (gmt 0)

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



Ah I had one hotlinking once. I simply changed the name of the .jpg file and the html and then I modified the old .jpg with bold large red font across saying "THIS IMAGE STOLEN FROM..."


I have many photos on my site, all also in high resolution.

Wehn somebody hotlinks this as background, this can cost much bandwith.

So I have a list of 15 site names, where requests on pictures are redirected on a "Do not hotlink" picture.