Can events fired from an iframe be handled by elements in its parent?

Posted by allyourcode on Stack Overflow See other posts from Stack Overflow or by allyourcode
Published on 2010-01-12T04:31:44Z Indexed on 2010/04/02 9:53 UTC
Read the original article Hit count: 182

Filed under:
|

Suppose I have a page located at www.example.com/foo, and it contains an iframe with src="http://www.example.com/bar". I want to be able to fire an event from /bar and have it be heard by /foo. Using the Prototype library, I've tried doing the following without success:

Element.fire(parent, 'ns:frob');

When I do this, in ff 3.5, I get the following error:

Node cannot be used in a document other than the one in which it was created" code: "4 Line 0

Not sure if that's related to my problem. Is there some security mechanism that's preventing scripts in /bar from kicking off events in /foo?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about prototype