views:

17

answers:

1

I have a page which needs to check whether it is contained within an iframe or not in effect whether the page is the top page.

I tried doing this: if(window == window.parent) and it works for Opera, FF, and Chrome but not for IE. is there some trick in IE I should use?

+1  A: 
if (top != self)
{
    // I'm in an iframe
}
Martin
… or some other kind of frame.
David Dorward
worked like a charm, thanks!
AndreasKnudsen