Set the height of the parent iframe adaptive content page

Set the parent iframe adaptive content page height, and the child page sets the parent page iframe height

Add the following code to the subpage


/* 设置父级iframe 自适应内容页高度,
   子页面设置父页面iframe高度               
*/
window.onload = function () {
    
    
	//var height = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
	var height = Math.max(window.outerHeight, document.body.clientHeight);               
	console.log(588, "高度" + height);            
	this.frameElement.height = height+38;
}

Guess you like

Origin blog.csdn.net/u011511086/article/details/132420697