A域引入B域的东西:
<div style="max-width:1300px;" id="dashboard2Vm">
<iframe id="dashboardIframeId" scrolling="no" frameborder="0" width="101%" height="100%" name="dashboardIframName" src="$!{v1}/dashboard/view.action?q.head=n" ></iframe>
</div>
B域中在加载页面后初始化页面的宽高,实现无缝融合
//初始化父级页面的高度和宽度
function initParentHeight(){
//获取父级页面的iframe对象
var pTar = parent.document.getElementById("dashboardIframeId");
//对ifram进行宽高设置
if (pTar && !window.opera){
pTar.style.display="block";
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
pTar.height = pTar.contentDocument.body.offsetHeight + 50;
//pTar.width = pTar.contentDocument.body.offsetWidth;
}else if(pTar.Document && pTar.document.body.scrollHeight){
pTar.height = pTar.document.body.scrollHeight + 50;
//pTar.width = pTar.document.body.scrollWidth;
}
}
}