iframe.document.body.scrollHeight is double the correct value
- by Dean J
<iframe name="asdf" id="asdf" onload="change_height(this)" src="asdf.jsp" width="250" scrolling="no" frameborder="0"></iframe>
function change_height(iframe) {
if (document.all) {
// IE.
ieheight = iframe.document.body.scrollHeight;
iframe.style.height = ieheight;
} else {
// Firefox.
ffheight= iframe.contentDocument.body.offsetHeight;
iframe.style.height = ffheight+ 'px';
}
}
ieheight is twice the actual height when this runs in IE7; haven't tested on IE6. It's the same value if I use scrollHeight or offsetHeight.
It's the correct height in Firefox.
Before I patch this by just dividing the IE value /2, what's the right way to do this?