running in an IFRAME or a FRAME?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sean Nolan

    running in an IFRAME or a FRAME?

    So it's always been easy to know if I'm running framed:

    if (window != top) ....

    Here's one I can't seem to figure out. Is there a way to determine if
    the frame I am in is a FRAME or an IFRAME? I'm hoping this is an easy
    one, but it's got me stumped, and I haven't found any good info here
    or on the web as of yet.

    Oh, it has to work cross-site, too ... so my easy solution to just
    look through window.parent.d ocument.getElem entsByTagname(" iframe")
    doesn't work.

    Thanks in advance for any help.
    ---S
  • Martin Honnen

    #2
    Re: running in an IFRAME or a FRAME?



    Sean Nolan wrote:[color=blue]
    > So it's always been easy to know if I'm running framed:
    >
    > if (window != top) ....
    >
    > Here's one I can't seem to figure out. Is there a way to determine if
    > the frame I am in is a FRAME or an IFRAME? I'm hoping this is an easy
    > one, but it's got me stumped, and I haven't found any good info here
    > or on the web as of yet.
    >
    > Oh, it has to work cross-site, too ... so my easy solution to just
    > look through window.parent.d ocument.getElem entsByTagname(" iframe")
    > doesn't work.[/color]

    I don't think you are able to write a script checking whether the page
    is inside of an iframe or inside of a frame if the frame and the
    containing page are on different servers.
    If not you already have the solution, check
    parent.document .getElementsByT agName('iframe' ).length

    --

    Martin Honnen


    Comment

    Working...