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.
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.
This is the bottom of my php iframe content:
<body onload="parent.resize_iframe(document.body.scrollHeight)">
<?php echo $display_table; ?>
As you see, I call a function to resize the iframe's height in the main page (parent page).
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.
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?
Is there any way of making it wait until the document is fully loaded?
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.
Hmmm, I really don't understand this, so please help me out here.
Thanks