S
Stevo
Does anyone know of a property that I can look at to see if the page my
script finds itself in was created as a frame or an iframe in the parent
page? My code needs to behave differently whether it's in an iframe or a
frame.
I know how to do it when the parent is in the same domain. I can just
test if parent.document.body.tagName=='frameset' and that tells me that
I must be in a frame. If that test returns false then I'm in an iframe.
The problem comes when the page I'm on is in a different domain to the
parent. I can't access many properties of the parent window, so I can't
determine whether it's a frameset or not. I can look at parent.frames
and if I'm frame 0, I can even look at parent.frames[0].location.href
but that still doesn't help me determine if I'm in a frame or iframe.
I need to know so that I can determine whether the content I want to
write should be written into the parent page or the current page. If the
parent is a frameset then I write into this current window. If the
parent is not a frameset, then I write into the parent window.
script finds itself in was created as a frame or an iframe in the parent
page? My code needs to behave differently whether it's in an iframe or a
frame.
I know how to do it when the parent is in the same domain. I can just
test if parent.document.body.tagName=='frameset' and that tells me that
I must be in a frame. If that test returns false then I'm in an iframe.
The problem comes when the page I'm on is in a different domain to the
parent. I can't access many properties of the parent window, so I can't
determine whether it's a frameset or not. I can look at parent.frames
and if I'm frame 0, I can even look at parent.frames[0].location.href
but that still doesn't help me determine if I'm in a frame or iframe.
I need to know so that I can determine whether the content I want to
write should be written into the parent page or the current page. If the
parent is a frameset then I write into this current window. If the
parent is not a frameset, then I write into the parent window.