Page 1 of 1

Auto closing of page with frames

Posted: Sat Oct 25, 2008 2:54 pm
by Sheridan
I have created a page with a number of frames. One of the frames has a form with a submit button.

On submit, I want to close the entire page (ALL the frames) and open the new page in a fresh window. How do I do that?

Re: Auto closing of page with frames

Posted: Sat Oct 25, 2008 3:21 pm
by Hannes2k
Hi,
this isn't possible with PHP, but you can use JavaScript:

<script language="JavaScript">
<!--
//if (parent.frames.length>=1) { //uncomment this, if the redirection should only happen if there are frames
window.top.location.href="new_site.php";
//}
//-->
</script>

But, frames are normaly not a good idea. Use instead a frameless design. It is easier to handle & to design and it's much better for bots from searchengines and for handicapped persons.

Re: Auto closing of page with frames

Posted: Sat Oct 25, 2008 3:37 pm
by Syntac
Why do you need frames?

Re: Auto closing of page with frames

Posted: Sat Oct 25, 2008 4:16 pm
by Sheridan
I am creating a rectangle of thumbnail photos with a login button in the middle of the rectangle. One frame will form the top of the rectangle, another will form the bottom and two more will form the sides. The password text box and login button will be in the empty middle of the rectangle.

Re: Auto closing of page with frames

Posted: Sun Oct 26, 2008 5:08 am
by Hannes2k
Hi,
use div containers (or even tables) instead of frames.