Skip to content

Instantly share code, notes, and snippets.

@LukeFF
Last active September 7, 2016 10:10
Show Gist options
  • Save LukeFF/c11586809409aa2d00f87d5145fc800c to your computer and use it in GitHub Desktop.
Save LukeFF/c11586809409aa2d00f87d5145fc800c to your computer and use it in GitHub Desktop.
automatic Iframe resizing on same domain
<iframe id="superFrame" src="..." style="width: 100%; border: none;" onload="resizeIframe(this)" scrolling="no"></iframe>
<script type="text/javascript">
function resizeIframe(iframe) {
if(iframe) {
iframe.height = '';
iframe.height = iframe.contentWindow.document.body.scrollHeight + 'px';
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment