Welcome to WebmasterWorld Guest from 54.159.129.152

Forum Moderators: open

Message Too Old, No Replies

Break out of IFRAME

Javascript to detect framing and break out?

     
6:41 pm on Jun 13, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 3, 2003
posts:38
votes: 0


I already use Javascript to detect whether my site is framed and break out, but this does not seem to work for sites framing my site in an IFRAME.

Is is there a reliable way to detect if your page is in an IFRAME and break out of it?

TIA.

6:46 pm on June 13, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
posts:3732
votes: 0


What does your script look like?
7:22 pm on June 13, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 3, 2003
posts:38
votes: 0


This JS code works fine to break out of "normal" (non-IFRAME) framing:

<script language="Javascript">
<!--
if (top.location!= self.location) {
top.location = self.location.href
}
//-->
</script>

But it doesn't seem to work with an IFRAME.

7:55 pm on June 13, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 3, 2003
posts:38
votes: 0


Interesting, the code I posted above appears to break out of an IFRAME in Mozilla and Netscape, but does odd things sometimes in Opera 6.05 (like displays the keword metatag content!).

I guess the only browser it doesn't work right is in IE6 and Opera.

8:10 pm on June 13, 2003 (gmt 0)

New User

10+ Year Member

joined:Jan 14, 2004
posts:2
votes: 0


That code works fine in my version of IE6, testing across domains.
8:31 pm on June 13, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 3, 2003
posts:38
votes: 0


OK, I think I see what I was doing wrong in IE. Thanks for the help.

It still does not work in Opera 6.05

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members