Dan
Dan

Reputation: 57881

How can I launch a javascript from an <iframe>?

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!

Upvotes: 0

Views: 415

Answers (3)

D.C.
D.C.

Reputation: 15588

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

Upvotes: 0

brian
brian

Reputation: 1080

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

Upvotes: 0

brian
brian

Reputation: 1080

you tried parent.?

Upvotes: 2

Related Questions