How to get the height of the called page in the iframe of HTML and act as the height of this iframe?

content of HTML: < iframe src= "/ 123.htm" name= "my111" id= "my222" onload= "gaodu ()" width= "100%" marginwidth= "10px" frameborder= "0" scrolling= "no" > < / iframe >

how do I get the height of "/ 123.htm" and use this height as the height of the iframe tag in HTML? The pages called by
iframe are different pages of the same site, which is probably what you call "same domain". Please help me not complete the code, use iframe in index.html, call / 123.html, and set the text height of 123.html to the height of iframe in index.html.

get down on your knees and ask the god for an answer. In a hurry.

Apr.07,2022

carry an answer from SO:

$('iframe').load(function() {
    this.style.height =
    this.contentWindow.document.body.offsetHeight + 'px';
});
Don't forget to load jQuery first.

< hr >

https://stackoverflow.com/que...



<script>
        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;
                }
            }
        };

        window.onload = function() {
            setIframeHeight(document.getElementById('external-frame'));
        };
    </script>
    <iframe src="backtop.html" frameborder="0" scrolling="no" id="external-frame" onload="setIframeHeight(this)"></iframe>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaed53-47fcc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaed53-47fcc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?