In my application, I have an iframe, and I would like to give it access to some functionality that changes the state of the application outside the iframe. This function should be triggered by the keydown event inside or outside the iframe.
In the iframe, I have the following code:
window.init = function (api) { api.bind(document); };
And the external application does something like:
iframe.contentWindow.init({ bind: function (element) { $(element).bind('keydown', function () { debugger; }); } });
In this case, init is called correctly, but the keydown event keydown never called. What am I doing wrong?
source share