title: Replace Entire Content of Iframe
body: <p>Is there a way to replace the ENTIRE contents of an iframe using Javascript (or Jquery)?</p>
  
  <p>For example if my iframe had the following content...</p>
  
  <pre><code>blah outside of html
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt; my title &lt;/h1&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  blah outside of html
  </code></pre>
  
  <p>..It could all be replaced by your script :)</p>
  
  <p>The best that I've seen so far is this: </p>
  
  <pre><code>$(youriframe).contents().find('html').html('your content here'); 
  </code></pre>
  
  <p>but that still wouldn't replace the content outside of the html tags. We have an interesting scenario where we must assure that ALL the content is replaced. </p>
  
  <p>OR a new iframe with fresh content is created and simply replaces the previous iframe.</p>
  
  <p>Please no comments about the src attribute.</p>