How to resize iframe based on content
How to resize iframe based on content
http://www.456bereastreet.com/archive/201112/how_to_adjust_an_iframe_elements_height_to_fit_its_content/
<script type="text/javascript">
function setIframeHeight(iframe) {
if (iframe) {
var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
if (iframeWin.document.body) {
iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
if (iframeWin.document.body.children.namedItem('aspnetForm') != null) { // 'aspnetForm' is the main form's name
iframe.height = iframeWin.document.body.children.namedItem('aspnetForm').offsetHeight;
}
}
}
};
</script>
No comments:
Post a Comment