Auto closing of page with frames

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Sheridan
Forum Newbie
Posts: 18
Joined: Sat May 31, 2008 1:50 pm

Auto closing of page with frames

Post 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?
Hannes2k
Forum Contributor
Posts: 102
Joined: Fri Oct 24, 2008 12:22 pm

Re: Auto closing of page with frames

Post 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.
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: Auto closing of page with frames

Post by Syntac »

Why do you need frames?
Sheridan
Forum Newbie
Posts: 18
Joined: Sat May 31, 2008 1:50 pm

Re: Auto closing of page with frames

Post 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.
Hannes2k
Forum Contributor
Posts: 102
Joined: Fri Oct 24, 2008 12:22 pm

Re: Auto closing of page with frames

Post by Hannes2k »

Hi,
use div containers (or even tables) instead of frames.
Post Reply