1
mouacy
How do I prevent my site from being display in an iframe in other's page?
  • 2005/2/26 1:13

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


I search in google and find only how to make an iframe. But I want to put a script on my page that will prevent it from being display in an iframe. Anyone?

2
just4fun
Re: How do I prevent my site from being display in an iframe in other's page?
  • 2005/2/26 1:40

  • just4fun

  • Just popping in

  • Posts: 55

  • Since: 2003/7/28


<script language="JavaScript" type="text/javascript">
<!--
function 
FrameBuster(){
  if (
top !=self)top.location=self.location;
}
// -->
</script>


add FrameBuster to onload event of body

<body onload="FrameBuster()">



3
mouacy
Re: How do I prevent my site from being display in an iframe in other's page?
  • 2005/2/26 6:17

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


I tried it with firefox and it doesn't work.

I add the function
Quote:

function FrameBuster() {
if (top !=self)top.location=self.location;
}


to the xoops.js and call it from

<body onload="FrameBuster()">

Doesn't work. Any more clue?

4
mouacy
Re: How do I prevent my site from being display in an iframe in other's page?
  • 2005/2/26 6:26

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


Also try it with IE6.0 and it doesn't work.

I place
Quote:

<script language="JavaScript" type="text/javascript">
<!--
function FrameBuster(){
if (top !=self)top.location=self.location;
}
// -->
</script>


inside the header of the theme.html file just below the xoops.js

and add onload="FrameBuster()" to the <body> to become

<body onload="FrameBuster">

no luck so far.

5
mouacy
Re: How do I prevent my site from being display in an iframe in other's page?
  • 2005/2/26 6:46

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


It doesn't seem to work with iframe.

6
felix220
Re: How do I prevent my site from being display in an iframe in other's page?
  • 2006/3/11 23:56

  • felix220

  • Friend of XOOPS

  • Posts: 8

  • Since: 2004/12/26


This is an old thread but I can see nothing else relevant.

I am trying to add the code to bust out of a frame and have searched about but can't see any conclusive solution [for a beginner]

I have edited the theme.html in the header/body, but I notice that the changes do not appear to load.. so I looked at header.php and noticed this line..

// Weird, but need extra <script> tags for 2.0.x themes
$xoopsTpl->assign('xoops_js', '//--></script><script type="text/javascript" src="'.XOOPS_URL.'/include/xoops.js"></script><script type="text/javascript"><!--');

Do I need to change something here to make the changes to the theme header stick?

If there is a method of adding the 'frame buster' that works I would be grateful for anyone who can point me in the right direction..

Thanks..

Login

Who's Online

255 user(s) are online (178 user(s) are browsing Support Forums)


Members: 0


Guests: 255


more...

Donat-O-Meter

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

Latest GitHub Commits