title: How to close window after iframe form submits
body: <p>I have a blank page with an iframe that displays a form from an <strong>external domain outside my control</strong>. I'm trying to write a bit of Javascript/jQuery that will close the window after the form is submitted.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;body&gt;
      &lt;script&gt;
          $('iframe input[type="submit"]').on('click', function () {
              window.close();
          });
      &lt;/script&gt;
  
      &lt;iframe src="SomeOtherDomain.com"&gt;&lt;/iframe&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Nothing happens when I click the button though. What am I doing wrong?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I'm not sure if it makes a difference or not but it looks like the iframe calls a second iframe... I've got an iframe inside an iframe.</p>