Connecting Tech Pros Worldwide Help | Site Map

running in an IFRAME or a FRAME?

Sean Nolan
Guest
 
Posts: n/a
#1: Jul 20 '05
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.document.getElementsByTagname("ifram e")
doesn't work.

Thanks in advance for any help.
---S
Martin Honnen
Guest
 
Posts: n/a
#2: Jul 20 '05

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.document.getElementsByTagname("ifram e")
> 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.getElementsByTagName('iframe').len gth

--

Martin Honnen
http://JavaScript.FAQTs.com/

Closed Thread