Javascript / IE 6/7: check if there is an iframe inside

I have a page that should check if it is contained in an iframe or not, whether the page affects the top page.

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

+3
source share
1 answer
if (top != self)
{
    // I'm in an iframe
}
+8
source

Source: https://habr.com/ru/post/1734552/


All Articles