title: Catch javascript:window.close() inside an iframe
body: <p>I am running a third party HTML content inside an <strong>iframe</strong> that I have no control over, and in some cases they have links that call <strong>javascript:window.close()</strong> directly. Something like this:</p>
  
  <pre><code>&lt;input type="button" onclick="javascript:window.close()" value ="CLOSE"&gt;
  </code></pre>
  
  <p>I have no way of finding an ID or an array position of this element. </p>
  
  <p>Naturally, it is ignored inside an iframe, but is there a way to catch when this event is fired? I tried </p>
  
  <pre><code>window.addEventListener("close", closeHandler, false);
  window.addEventListener("onbeforeunload", closeHandler, false);
  </code></pre>
  
  <p>but it completely ignores it. Is there a way to somehow catch ALL JavaScript events/calls? Any recommendations are welcome.</p>