title: scrape parent page html from iframe
body: <p>I have an iframe which is used to generate a PDF from its parent page. The PDF maker (ABCpdf) requires an HTML file which it then converts.</p>
  
  <p>What I do at present is scrape the parent's HTML using:</p>
  
  <pre><code>var temp;
  temp=parent.document.body.parentNode.innerHTML;
  </code></pre>
  
  <p>then I use the form in the iframe to submit it to the server where it is massaged to remove things like the iframe sections before being saved as a temporary HTML file for the PDF maker.</p>
  
  <p>However the resulting HTML code is mangled, with <code>&lt;BODY&gt;</code> instead of <code>&lt;body&gt;</code> etc and the quotes around IDs removed etc.</p>
  
  <p>Is there a better way to grab the HTML?</p>
  
  <p><em>The reason I don't just regenerate the page as HTML is that the parent page is a complex report. It contains various controls to allow the user to show/hide sections or sort rows in tables. So the HTML I get has to reflect the user customisations.</em></p>
  
  <p>thanks</p>