1
Peekay
Leeching websites in an iFrame - can it be prevented?
  • 2006/12/19 19:20

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


I have a domain where I build prototype websites for clients.

One particular project had been dragging on for a month or two during which time I had received a number of minor text changes and a period of inactivity while my client supposedly went on holiday.

Today, while investigating an un-related issue, I checked my server logs for that domain - and discovered why the client was slow in finishing the job. It turns out he had set up a single page with an iFrame on a live domain which linked to my prototype!. His client had been using the site for over a month.

Needless to say I pulled the site and issued an invoice. However, I was wondering if anyone knew of a way to display a rude notice if an iFrame is used to display content from another URL, or to prevent it entirely?
A thread is for life. Not just for Christmas.

2
Cuidiu
Re: Leeching websites in an iFrame - can it be prevented?
  • 2006/12/19 19:52

  • Cuidiu

  • Quite a regular

  • Posts: 358

  • Since: 2006/4/23


You could try inserting this code in the head of your pages:
<script language="javascript1.1" type="text/javascript">
script>

It should prevent your site from being framed.
C
Quote:

However, I was wondering if anyone knew of a way to display a rude notice if an iFrame is used to display content from another URL, or to prevent it entirely?
[size=x-small]Working sites:
XOOPS 2.0.16 PHP 5.2.2, MySQL 5.0.24a-standard-log, Apache/2.0.54 (Unix)
XOOPS 2.2.4, PHP 4.3.10, MySQL 3.23.58, Apache/1.3.33 (Unix)[/size]

3
Peekay
Re: Leeching websites in an iFrame - can it be prevented?
  • 2006/12/19 20:24

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Thx Cuidiu. That's a useful bit of code, but it only stops the site being framed - not displayed. I believe I can do this with htaccess file, or a combination of PHP/htaccess. I am testing both now.

Every now and then I keep saying "cheeky b****ard!
A thread is for life. Not just for Christmas.

4
irmtfan
Re: Leeching websites in an iFrame - can it be prevented?
  • 2006/12/19 20:36

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


very nice code Cuidiu!

Quote:
but it only stops the site being framed - not displayed

i cant understand this.
what do you mean?

5
Cuidiu
Re: Leeching websites in an iFrame - can it be prevented?
  • 2006/12/19 20:37

  • Cuidiu

  • Quite a regular

  • Posts: 358

  • Since: 2006/4/23


I must have misunderstood. I thought you were asking how to prevent a site from being framed.

Good luck.

Quote:

Peekay wrote:
Thx Cuidiu. That's a useful bit of code, but it only stops the site being framed - not displayed. I believe I can do this with htaccess file, or a combination of PHP/htaccess. I am testing both now.

Every now and then I keep saying "cheeky b****ard!
[size=x-small]Working sites:
XOOPS 2.0.16 PHP 5.2.2, MySQL 5.0.24a-standard-log, Apache/2.0.54 (Unix)
XOOPS 2.2.4, PHP 4.3.10, MySQL 3.23.58, Apache/1.3.33 (Unix)[/size]

6
Peekay
Re: Leeching websites in an iFrame - can it be prevented?
  • 2006/12/19 20:56

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


@irmtfan
The site has an iFrame (or possible frameset frame) which loads our design prototype, but the address bar remains their domain URL.

I found a good online code generator for anti-leeching image protection using htaccess at:

http://isnoop.net/dev/mod_rewrite.php

but it ain't working for me as yet to stop the page being displayed.
A thread is for life. Not just for Christmas.

7
Lance_
Re: Leeching websites in an iFrame - can it be prevented?
  • 2006/12/19 20:56

  • Lance_

  • Home away from home

  • Posts: 983

  • Since: 2004/1/12


The code above is fine, just change the behaviour in the if clause.

You can then redirect to a warning page about leeching through a frame. Doesn't need to be the actual site reopened.
GDL-Web.com :: Website development.
Xoopslance.com::Freelancing and Projects
thelionsden-arena.net:: Clan/League/Ladder Hosting

8
Peekay
Re: Leeching websites in an iFrame - can it be prevented?
  • 2006/12/19 21:08

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


@Lance
This is indeed true. I changed the condition to:
<script language="javascript1.1" type="text/javascript">
script>

Which works a treat!

Thx to everyone who responded.
A thread is for life. Not just for Christmas.

9
Cuidiu
Re: Leeching websites in an iFrame - can it be prevented?
  • 2006/12/19 21:15

  • Cuidiu

  • Quite a regular

  • Posts: 358

  • Since: 2006/4/23


That's pretty funny... keep in mind though that Google will hold your site in a frame - I believe it's the Google images area. What will happen is - a visitor will be checking out your image on Google, the frame buster will pop the site out of the frame and then the visitor will see the page you are displaying. Be gentle as you never know who will be viewing the page.

Edit: That's only if Google has indexed that page. If not, then no worries, mate!
[size=x-small]Working sites:
XOOPS 2.0.16 PHP 5.2.2, MySQL 5.0.24a-standard-log, Apache/2.0.54 (Unix)
XOOPS 2.2.4, PHP 4.3.10, MySQL 3.23.58, Apache/1.3.33 (Unix)[/size]

10
irmtfan
Re: Leeching websites in an iFrame - can it be prevented?
  • 2006/12/19 21:21

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


this topic deserved for a faq.
@Cuidiu :
is there any way to except some sites? (like google , yahoo and ...)

Login

Who's Online

414 user(s) are online (296 user(s) are browsing Support Forums)


Members: 0


Guests: 414


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits