Bug Tracker

Opened 8 years ago

Closed 5 years ago

Last modified 4 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 7 years ago.
testcase.zip (21.7 KB) - added by chris.j.smith 7 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 7 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 7 years ago by morgan

Changed 7 years ago by chris.j.smith

comment:2 Changed 7 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 5 years ago by dmethvin

  • Keywords needsreview added
  • Status changed from new to open

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 5 years ago by dmethvin

  • Resolution set to patchwelcome
  • Status changed from open to closed

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.