title: Append document to iFrame
body: <p>I am currently receiving parts of a webpage through an XHR, and then parsing them using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/DOMParser" rel="nofollow">DOMParser</a>. After this I change some of the elements, but I am failing to append the document to the iFrame. </p>
  
  <p>The document that is parsed is all right, but when appending this document to the iFrame by calling <code>iFrame.contentDocument = parsedDocument</code>, <code>iFrame.contentDocument</code> stays empty (actually there are html, head and body tags but their content is empty).</p>
  
  <p>I am parsing the received data like so:</p>
  
  <pre><code>var parser = new DOMParser();
  var parsedDocument= parser.parseFromString(xhr.response, 'text/html');
  </code></pre>
  
  <p>And my expectation was to do something like this:</p>
  
  <pre><code>iFrame.contentDocument = parsedDocument;
  </code></pre>