window.parent is always undefined in an iframe
- by Bill Yang
Hi there, I have recently ran into this strange issue, I was trying to reference parent window in an iframe, but somehow window.parent or parent are always undefined. 
I got around the problem by using window.top, but this question still haunts me.
Why is window.parent undefined? 
This is a .NET web app, if it helps. 
Update: I would like to add that both parent and child iframes are pointed to the same domain (localhost). As for code, I have tried the following code:
if (parent != null)
{
  // do something
}
where do something never happens, I also tried 
alert(parent)
and 
alert(window.parent)
they always come out as null.