Forum Moderators: open

Message Too Old, No Replies

Which code do you use to break out of frames?

... found 7 different code samples

         

tombola

10:08 am on Jan 24, 2004 (gmt 0)

10+ Year Member



1. if (window!= top) { top.location.href = location.href; }

2. if (top.location!= location) { top.location.href = document.location.href; }

3. if (window!= window.top) { top.location.href = location.href; }

4. if (parent.frames[1]) { parent.location.href = self.location.href; }

5. if (top!= self) { top.location.href = location.href; }

6. if (top.frames.length!= 0) { top.location = self.document.location; }

7. if (parent.frames.length > 0) { parent.location.href = location.href; }

dcrombie

1:19 pm on Jan 24, 2004 (gmt 0)



1. you should use "self" instead of "window" but it probably works
2. should work
3. no
4. no
5. yes - I'd use this one
6. no
7. this will only move your page up one level at a time

bird

12:32 pm on Jan 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



8. if(parent.location&&parent.location!=window.location){top.location=window.location;}

jomaxx

4:15 pm on Jan 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



BTW, you might want to adjust the code to specifically allow "good" framing of your site, e.g. by Google's translation tool.