0

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 ?

Community
  • 1
  • 1
Bharat Jain
  • 177
  • 1
  • 16
  • 5
    _"Also , at [this](http://stackoverflow.com/questions/2381336/detect-click-into-iframe-using-javascript) 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 ?"_ I think you've answered your own question here. If you have no control over the other page, then no, it's not possible. Imagine you put a banking site in an iframe - you'd be able to capture the keystrokes of someone logging in. – James Thorpe Sep 30 '15 at 09:52
  • @JamesThorpe I strongly agree ! – Bharat Jain Sep 30 '15 at 10:02

1 Answers1

0

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

mplungjan
  • 169,008
  • 28
  • 173
  • 236
Josh Lin
  • 2,397
  • 11
  • 21
  • I have clearly stated that the url of iframe is external link which is on different domain . – Bharat Jain Sep 30 '15 at 10:04
  • domain is not a problem, if u can't control content of iframe , it would be. still u can use proxy+modify or other method to make as is same domain, or ajax into same document – Josh Lin Sep 30 '15 at 10:27