For example:
<iframe name="Stack" src="https://stackoverflow.com/" width="740"
frameborder="0" scrolling="no" id="iframe"> ...
</iframe>
I want it to be able to adjust its height according to the contents inside it, without using scroll.
17 s
Add this to your <head>
section:
<script>
function resizeIframe(obj) {
obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';
}
</script>
And change your iframe to this:
<iframe src="https://stackoverflow.com/questions/9975810/..." frameborder="0" scrolling="no" onload="resizeIframe(this)" />
As found on sitepoint discussion.