Created
January 30, 2021 06:27
-
-
Save secretpray/48c85126803e665ab320a59874e15109 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="application/javascript"> | |
function resizeIFrameToFitContent( iFrame ) { | |
iFrame.width = iFrame.contentWindow.document.body.scrollWidth; | |
iFrame.height = iFrame.contentWindow.document.body.scrollHeight; | |
} | |
window.addEventListener('DOMContentLoaded', function(e) { | |
var iFrame = document.getElementById( 'iFrame1' ); | |
resizeIFrameToFitContent( iFrame ); | |
// or, to resize all iframes: | |
var iframes = document.querySelectorAll("iframe"); | |
for( var i = 0; i < iframes.length; i++) { | |
resizeIFrameToFitContent( iframes[i] ); | |
} | |
} ); | |
</script> | |
<iframe src="usagelogs/default.aspx" id="iFrame1"></iframe> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment