简体   繁体   中英

How to capture all the events performed on iframe?

NOTE : The url of iframe is external link which is on different domain that I cannot modify.

I could get a solution in which I was able to detect only a click event .

var monitor = setInterval(function(){
var elem = document.activeElement;
if(elem && elem.tagName == 'IFRAME'){
    message.innerHTML = 'Clicked';
    clearInterval(monitor);
}
}, 100);

Also , at this place it has been stated that there is no way we can capture the events of an external iFrame . I want to capture all the events . Is it possible ?

If you own both sites/domains then use postmessage when clicking in child document, this won't work on IE8

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM