The problem of adaptive height of iframe

the code is as follows:

< section class= "inner-center clearfix" >

<aside class="aside-left">
    <ul>
        <li class="act"></li>
        <li><a data-class="collect"></a></li>
        <li><a data-class="buyClass"></a></li>
    </ul>
</aside>
<main class="main"> 
    <iframe name="myiframe" id="myiframe" src="class.html" frameborder="0"  width="100%" height="100%" scrolling="no"  allowtransparency="yes" onload="setIframeHeight(this)"></iframe></main></section>
<script>
function (iframe) {
    var iframeWin = iframe.contentWindow ||         iframe.contentDocument.parentWindow;
    if (iframeWin.document.body) {
            iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
        }
    }
</script>


:

question:
after writing this js function, Firefox is compatible, but Google and Sogou are not compatible. What"s going on? How to solve it?

Mar.25,2022

restrictions on browsers
do not open it in local file:// format. If you put the page on the server, the error will not be reported. windows users can debug locally through iis .

Menu