开发者

javascript / IE 6/7: check if within an iframe

开发者 https://www.devze.com 2022-12-21 20:28 出处:网络
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 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 开发者_如何学Pythonthis: 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?


if (top != self)
{
    // I'm in an iframe
}
0

精彩评论

暂无评论...
验证码 换一张
取 消