View Full Version : Closing an HTML frameset, returning to standard (non-frameset) HTML

01-09-2011, 04:02 AM
We want to navigate between framesets and non-framesets in a website, without leaving a lot of stranded parents OR children. A solution should work for all browsers (or at least for Firefox and Chrome; IE would be nice, but we've lost faith).

Two cases are considered:

(1) An HTML frameset (A) invokes a child HTML frameset (B). The child frameset (B) is to close, returning to the parent (A). This works; (B) disappears and (A) remains.

A clue was found: use top.close() target="TOP" upon exiting the child.

(2) A simple non-frames HTML page (C) invokes a child HTML frameset (D). The child frameset (D) is to close, returning to the parent (C). This doesn't work! The result is that the parent disappears and the child remains.

We attempted to use top.close() in the child, but it fails.

Most discussions are based on using a popup window or a form. These are neither. We have found references stating that this problem cannot be solved, yet we've solved it in the first case EXCEPT that it only works in Firefox and Mozilla. (Chrome fails utterly, and IE renders so poorly that we'd have to redesign the whole page for the solution to work properly.)

We'd be happy to provide code fragments, but as we're dealing with framesets the 'fragments' are pretty extensive.

01-09-2011, 05:00 AM
This is no longer an entirely HTML question once you start using things like:


That's javascript. And generally javascript cannot close() anything that wasn't opened using the javascript open() method. This may or may not be a factor in one or more of the scenarios you describe in one or more of the browsers you're testing in.

It's possible that it could be all HTML though. If everything you are trying to do happens when you click on a link that loads a page (frameset or single page) and you just want that to take over the current tab or window:

<a href="whatever.htm" target="_top">Whatever</a>

will do the trick, no javascript required.