Adding event handler to an iframe using JQuery

后端 未结 4 712
广开言路
广开言路 2020-12-01 19:07

I want to assign a keydown event handler to an iframe. Something similar to the pure JS:

document.getElementById(\'iframe_id\').contentWindow.addEventListene         


        
4条回答
  •  独厮守ぢ
    2020-12-01 20:07

    Just something to keep in mind: this will never work, as far as I understand, if the iframe content is cross-domain. You'll end up with permissions errors: Permission denied for http://... to get property HTMLDocument.nodeType from http://.... Browsers limit parent child dom permissions to same domain.

提交回复
热议问题