Skip to content

Instantly share code, notes, and snippets.

@wancw
Created June 8, 2010 08:48
Show Gist options
  • Save wancw/429776 to your computer and use it in GitHub Desktop.
Save wancw/429776 to your computer and use it in GitHub Desktop.
<!-- Dynamically adjust an iframe’s height
via http://www.mattcutts.com/blog/iframe-height-scrollbar-example/ -->
<body onload="resizeFrame(document.getElementById('childframe'))">
<script type=”text/javascript”>
/* Firefox worked fine.
Internet Explorer shows scrollbar because of frameborder */
function resizeFrame(f) {
f.style.height = f.contentWindow.document.body.scrollHeight + “px”;
}
</script>
<iframe frameborder="0" border="0"
src="./child-frame.html"
name="childframe"
id="childframe"></iframe>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment