who framed me? Frames did!

Out of context: Reply #3

  • Started
  • Last post
  • 3 Responses
  • CAJTBr0

    only problems with that are:

    1) if someone includes your page as part of their frameset, the script won't fire.

    2) say you have 3 pages that load into the iframe, and put that code into each of them, when the script fires from pages 2 or 3, it's going to reload the container page with the iframe as page 1 (the default page).

    if you're bothered about that, you can get around both problems.

    get around the first one by using an if top.location.href != (or similar) rather than the if window == top.

    you can get round the second by passing the name of the page that's firing the script to the top frame in a query string, and having it automatically load the iframe as the file specified in the query string (if the query string isn't empty).

View thread