views:

67

answers:

4

There is an iframe on the page.

Can the parent document (iframe parent) be accessed from this iframe?

What I want to do: when the user presses a button inside iframe something happens on the main page

Thanks!

+1  A: 

you tried parent.?

brian
A: 

If i understand correctly, this behavior is not allowed. An iframe would contain contents from some other domain, and if that domain could issue code to affect the elements of the first domain, security ruin would ensue. Read this info about the same origin policy: http://en.wikipedia.org/wiki/Same_origin_policy

darren
common courtesy to explain a down vote...
darren
no down vote from me, but an iframe doesn't necessarily have to have contents from another domain.
AUSteve
ah good point, i should clarify to say IF an iframe contained data from another domain. Thanks.
darren
A: 

In my experience, it works, as long as its the same domain.

brian
Very useful post
Dan
+1  A: 

Yes

floyd