[thelist] ANOTHER frames question

George Dillon evolt at georgedillon.com
Tue Sep 11 03:39:19 CDT 2001

> The quick and dirty way is to test via javascript whether
> the page is being load "as top".

There is another way, which also busts your page out of anyone else's
frameset.  I found this technique at irt.org, which has comprehensive FAQs
on frames and such, downloadable as zips...

In your frameset, create a hidden frame and give it a unique name (e.g.
"FR728943AME").  Then test for a frame with that name at the appropriate
position in the frameset.  The following code also adds the location of the
unframed page to the search string so it can then be used to load the
correct page into the frameset:

<CODE type="Framechecking">

var thispageRef = location.href;

function frameCheck(header)
  if (document.layers && (self.innerHeight==0 && self.innerWidth==0))
    if ((top == self) || ((document.images) ?
        (parent.FR728943AME ? false : true)
        : (parent.frames[2].name != 'FR728943AME'))
      { top.location.href='/frameset.htm?' + thispageRef  }


For a more detailed explanation see:

Re-directing access within Frames #2


George Dillon

More information about the thelist mailing list