About the first kind of iframe adaptive height problem is relatively simple
Recalculate the height of the page when it is finished loading
1 document.onreadystatechange=function() { 2 if( document.readystate== "complete") {3 window.parent.document.getElementById ("Iframeid"). height=document.body.scrollHeight; 4 } 5 }
Another is the page has the use of jquery Ajax request, the page loaded, the request continues, the height of the page is still changing
This use of the above method completely does not achieve the effect
The second Ajaxcomplete method using jquery, each time the AJAX request is complete, gets the page height again to change the iframe height
function Getheightouat () { window.parent.document.getElementById ("Iframeid"). height= document.body.scrollHeight; } $ (document). Ajaxstart (function() {}) . Ajaxcomplete (function() { Getheightouat (); }). Ajaxstop (function() {});
About an IFRAME adaptive height problem with Ajax requests