Bug Tracker

Opened 15 years ago

Closed 12 years ago

Last modified 11 years ago

#2707 closed bug (patchwelcome)

Event isn't fired into an iframe

Reported by: telega Owned by:
Priority: major Milestone: 1.2.4
Component: event Version: 1.2.3
Keywords: needsreview Cc:
Blocked by: Blocking:


Code $("iframe").contents().trigger("myevent"); doesn't fire event to iframe contentDocument.

Attachments (2)

jquery.contextswitch.js (947 bytes) - added by morgan 14 years ago.
testcase.zip (21.7 KB) - added by chris.j.smith 14 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 14 years ago by morgan

This really cannot be considered a bug if the event was setup from within the iframe. Because of the iframe you are working with two DOMs. Outside the frame (DOM1), the event does not exist because it was setup in the iframe (DOM2). Attached is a proof of concept plugin that allows context switching. Meaning if contents() sees that the current element is an iframe, and contains jQuery, the chain is switch from the outer instance of jQuery to the inner instance. Allowing events to be trigger. Testing so far has been limited just to showing it works (FF3.0.3).

Changed 14 years ago by morgan

Attachment: jquery.contextswitch.js added

Changed 14 years ago by chris.j.smith

Attachment: testcase.zip added

comment:2 Changed 14 years ago by chris.j.smith

I've encountered the same problem. I've attached a test case. I tried appying the jquery.contextswitch.js to it but it's not working either. Any ideas? The cross-frame event just gets swallowed.

Working on IE8/FF3.0.7.

comment:3 Changed 12 years ago by dmethvin

Keywords: needsreview added
Status: newopen

This could only be supported *at all* if the domains were the same, but even then I don't think we want to say we support it. There are issues with cleaning up cross domain events as well, see #7045.

comment:4 Changed 12 years ago by dmethvin

Resolution: patchwelcome
Status: openclosed

Having one frame control and trigger events across frames (parent to child or vice-versa) is not supported right now. There are several security and memory leak issues that would need to be overcome. It might be possible for us to provide hooks that allow an external plugin to do this, if you are interested please contact us.

Note: See TracTickets for help on using tickets.