running in an IFRAME or a FRAME?

S

Sean Nolan

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("iframe")
doesn't work.

Thanks in advance for any help.
---S
 
M

Martin Honnen

Sean said:
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("iframe")
doesn't work.

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').length
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top