title: Remove iframe before load page
body: <p>How do I remove an iframe before a page loads?</p>
  
  <p>On my website I have users fill out a surveymonkey survey in an iframe. Upon completion of the survey, surveymonkey redirects to a page in my website domain. This new page is still trapped within the iframe; I want the iframe removed before this new page is loaded. I tried the following code, but this removes both the iframe AND the content of this new page I want loaded, producing a blank screen:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;
  &lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function(){
  $('iframe', parent.document).remove();
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;/html&gt;
  &lt;?php
  //the content for the page I want loaded
  ?&gt;
  </code></pre>
  
  <p>Any suggestions?</p>