手机网页嵌入另一个网页自适应
<meta name=”viewport” content=”width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0″/>
<script language=”Javascript”>
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf(“Firefox”)).split(“/”)[1]
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0
function dyniframesize(iframename) {
var pTar = null;
if (document.getElementById){
pTar = document.getElementById(iframename);
}
else{
eval(‘pTar = ‘ + iframename + ‘;’);
}
if (pTar && !window.opera){
//begin resizing iframe
pTar.style.display=”block”
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
//ns6 syntax
pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight;
}
else if (pTar.Document && pTar.Document.body.scrollHeight){
//ie5+ syntax
pTar.height = pTar.Document.body.scrollHeight;
}
}
}
</script>
<iframe id=”myTestFrameID” onload=”javascript:{dyniframesize(‘myTestFrameID’);}”
marginwidth=0 marginheight=0 frameborder=0 scrolling=no src=”http://weixin1.nczhenxin.com/app/index.php?i=4&c=entry&m=cgc_baoming_share&do=enter&id=4&form=login” width=100% height=100%></iframe>