I am trying to pass key events [keydown, keyup] triggered on main window to inner iframe, with no luck; both the pages [page loaded in main window & page loaded in iframe] are from same domain; below is the code I tried.
$(document.body).on('keyup keydown', function (event) {
$($('#innerIframe')[0].contentWindow.document).trigger(event);
});
Can you point what I am missing/doing wrong here.
I solved it in a different way, Instead of passing/forwarding key events from main window to inner iframe, I updated the event listener binding code, in iframe as below
$(document).add($(parent.document)).on('keyup keydown', function (event) {
// process event
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.