Bug Tracker

Ticket #2707 (closed bug: patchwelcome)

Opened 7 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

Description

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

Attachments

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

Change History

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

Changed 6 years ago by chris.j.smith

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

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

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.