FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Breaking out of frames
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Breaking out of frames [message #30181] Thu, 09 February 2006 18:17 Go to next message
treebeard is currently offline  treebeard   United States
Messages: 44
Registered: April 2004
Location: Huge Universe
Karma: 0
Member
Recently another site "hijacked" our forum by framing it in a frameset with only one frame, src=our forum url. I added a bit of javascript to break out of the frame:

<Script Language="JavaScript">
<!--
setTimeout ("changePage()", 0);
function changePage() {
if (self.parent.frames.length != 0)
self.parent.location= "index.php";
}
// -->
</script>

This should only check to see if the page is in a frame, and if so, break out to the self parent location. And it worked. However, several users started to complain about odd forum behavior, getting bounced back to the homepage, etc. So really two questions:

1) Is there a better way to prevent another site from framing the forum?

2) Why would this javascript cause problems if you're NOT browsing the forum in a frameset?

Thanks!
Re: Breaking out of frames [message #30204 is a reply to message #30181] Sat, 11 February 2006 20:26 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Ideally this should be inside an onLoad() event of the body tag. Inside it you should put something along the lines of:
if(parent.location.href!=location.href) top.location.href=location.href;


FUDforum Core Developer
Re: Breaking out of frames [message #30207 is a reply to message #30204] Sat, 11 February 2006 20:37 Go to previous message
treebeard is currently offline  treebeard   United States
Messages: 44
Registered: April 2004
Location: Huge Universe
Karma: 0
Member
Thanks, Ilia. That's what I was trying for. I'll give it another go.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: UNABLE TO WRITE TO SQL LOG FILE
Next Topic: Import Data
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 22:07:25 GMT 2024

Total time taken to generate the page: 0.02496 seconds