I use this code to break out of frames:

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

Put this code in the <head> section between <script> tags.
If the document isn't on top, it soon will be.
(This solution slows the loading of the page a bit, the browser will
have to go thru the page once more, I think.)

Anders

----- Ursprungligt meddelande ----- 
Från: "Brinkman, Theodore" <[EMAIL PROTECTED]>
Till: "PHP List" <[EMAIL PROTECTED]>
Skickat: den 15 mars 2002 17:27
Ämne: RE: [PHP] Targetted redirection?


> OK, If I understand correctly, the following scenario would work?
> 
> Given: My site is being brought up inside somebody else's (say
> about.com)frameset.  [We'll call this page about.html]
> Given: I want my main page (index.html) to break out of the frames in the
> about.html page.  
> 
> Solution: My main page (index.html) should send header('Window-target:
> _Top');
> 
> So, if I use frames, and I want to keep my frameset page out of someone
> else's frame, I should send that header for my frameset page?
> 
> Is this correct?
> 
> - Theo
> 
> 
> -----Original Message-----
> From: Analysis & Solutions [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 15, 2002 10:27 AM
> To: PHP List
> Subject: Re: [PHP] Targetted redirection?
> 
> 
> Hi Folks:
> 
> Okay, here's what I'm talking about...  A sample system.  Four files.
> 
> index.php     main page holding the frameset.  frameset has two
>               frames.  one on left.  one on right.
> left.php      navigation menu that goes in the left hand frame
> right.php     content in right hand frame.  this page is the default
>               one that comes up in the initial frameset.
> right2.php    another page for the right hand frame
> 
> 
> ***************** index.php ******************
> 
> <?php
> #   This has no effect.
> #   header('Window-target: _top');
> ?>
> 
> <html>
> <head><title>index page</title></head>
> <frameset COLS="120,*">
> <FRAME SRC="left.php" name="menu" scrolling="no">
> <frame src="right.php" name="content">
> </frameset>
> </html>
> 
> 
> ***************** left.php ******************
> 
> <?php
> #   Turning this on will jump this page out of the frames.
> #   header('Window-target: _top');
> ?>
> 
> <html><head><title>the menu</title></head><body>
> <a href="right.php" target="content">right</a>
> <br /><a href="right2.php" target="content">right 2</a>
> </body></html>
> 
> 
> ***************** right.php ******************
> 
> <?php
> #   Turning this on will jump this page out of the frames.
> #   header('Window-target: _top');
> ?>
> 
> <HTML><HEAD><TITLE>Right</TITLE></HEAD><BODY>
> Hi there. This is the main content page in the right frame.
> </BODY></HTML>
> 
> 
> ***************** right2.php ******************
> 
> <?php
> #  This has no effect.
> #  header('Window-target: _top');
> ?>
> 
> <HTML><HEAD><TITLE>Right 2</TITLE></HEAD><BODY>
> Hi there. This is the secondary content page in the right frame.
> </BODY></HTML>
> 
> 
> 
> Now, put all those files on your machine.  Hit index.php and you'll see 
> everything normally.  Then, uncomment the header function in left.php or 
> right.php and you'll see that page jump out of the frames.  But, turn 
> the header on in index.php or index2.php and you'll still be in the 
> frames.
> 
> Enjoy,
> 
> --Dan
> 
> -- 
>                 PHP scripts that make your job easier
>               http://www.analysisandsolutions.com/code/
>          SQL Solution  |  Layout Solution  |  Form Solution
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to