Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function resizeFrame(){
- var frame = parent.document.getElementsById(window.me);
- frame.style.height = document.offsetHeight;
- }
- //init function
- bunding.doSomeWork(callbackFunction);
- ...
- function callbackFunction()
- {
- //does some HTML output
- resizeFrame();
- }
- <!DOCTYPE html>
- <html>
- <head>
- <title>so-iframeResize</title>
- <script type="text/javascript" >
- onframeload=function(iframe) {
- var doc = iframe.contentWindow.document;
- iframe.style.height = Math.max(
- doc.getElementsByTagName("html")[0].offsetHeight,
- doc.body.offsetHeight // IE prefers this value
- ) + "px";
- };
- </script>
- </head>
- <body>
- <div id="page">
- <iframe src="about:blank" onload="onframeload(this)">
- </iframe>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment