Dynamic iframe height

Adjust iframe height to its content after loading page
Needed this trick in this website to enhance speed in one of the pages.
and worked great, it will increase height of page to accomodate entire content of iframe after loading iframe inside the main page.

CodeFunctionName
What is this?

Public

Tested

Original Work
< head >
< script >
    function resizeIframe(obj) {
        obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';
    }
< /script >
< /head >
< body >



< iframe src="..." frameborder="0" scrolling="no" onload="resizeIframe(this)" / >


< /body >

Views 96

Downloads 42

CodeID
DB ID