views:

319

answers:

1

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.

A: 

Security - where IS window.parent....

also check case of property... js is case sensitive...

JL
as for "where", do you mena the url? everything is localhost
Bill Yang