title: Is it possible to detect window.close from iframe?
body: <p>I have a modal (a React component from my application), and inside it i have an iframe. I don't have control over the iframe, and I know it calls window.close after some action is taken. Is there a way to detect when the content inside the iframe called window.close, so I can also close the modal?</p>
  
  <p>Important: I'm not using jQuery, only pure javascript.</p>
  
  <p>iframe code:</p>
  
  <pre><code>      &lt;iframe height='500' width='340'                      
          src='http://content_url'
          ref={(f) =&gt; { this.ifr = f; }}&gt;
        &lt;/iframe&gt;
  </code></pre>
  
  <p>with this ref, I can refer to the iframe from my react component:</p>
  
  <pre><code>  componentDidMount() {
      this.ifr.onload = () =&gt; {
        //whatever action
      };
    }
  </code></pre>
  
  <p>but I can't do what I want with the unload event, because the iframe is not unloaded, it just calls window.close inside it.</p>
  
  <p>Thanks!</p>