title: Can't figure out why Chrome/Safari can't get the ScrollHeight right here
body: <p>I just asked a question about why a certain js code won't work in Chrome and Safari 100%, but after more troubleshooting I think I have found out that this is the question I should be posting.</p>
  
  <p>I have a page which has a form in it. This form's target is an iframe on the same page.
  The iframe is dynamic, and php based.</p>
  
  <p>This is the bottom of my php iframe content:</p>
  
  <pre><code>&lt;body onload="parent.resize_iframe(document.body.scrollHeight)"&gt;
  &lt;?php echo $display_table; ?&gt;
  </code></pre>
  
  <p>As you see, I call a function to resize the iframe's height in the main page (parent page).</p>
  
  <p>This works fine, and it does in fact get resized, BUT, in Chrome and Safari the resize is setting a height "higher" than it should be. So if the height is 500px then Chrome and Safari sets it to around 2000px, which is the maximum of the iframe document height.</p>
  
  <p>Why is this? One thought might be that the body isn't fully loaded before the scrollHeight is being sent to the resize function maybe?</p>
  
  <p>Is there any way of making it wait until the document is fully loaded?</p>
  
  <p>One thing that confuses me is that when I click a link on the main page, and then hit back, the page resize works good, and is set to 500px as it should be even in Chrome/Safari. But that's when I hit "back" in the browser.</p>
  
  <p>Hmmm, I really don't understand this, so please help me out here.</p>
  
  <p>Thanks</p>