I\'m trying to resize (make bigger or smaller) an iframe based on it\'s contents. After a click on each page a method is called which does the resizing.
In Chrome I
Before you ask for the height of the document inside the iframe you should set the height of the iframe object to "auto". Something like this:
objIframe = document.getElementById('theIframeId');
objIframe.style.height = 'auto';
And now:
document.body.scrollHeight
returns the actual height of the document.
According to spec, Element.scrollHeight
will round the value to an integer. If you need an accurate fractional value, use Element.getBoundingClientRect()
instead.
Did you try using document.documentElement.scrollHeight
instead?