时间:2023-04-06加入收藏
<iframe src="https://****.cn" id="myiframe" scrolling="yes" frameborder="0" width="100%"></iframe>
<script type="text/javascript">
var ifm = document.getElementById("myiframe");
ifm.height = document.documentElement.clientHeight;
</script>
<iframe src="http://www.bingdou.com.cn" style="width:100%;height:1100px" name="iframe_a" frameborder="no" id="ifr" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>
<script>
// 计算页面的实际高度,iframe自适应会用到
function calcPageHeight(doc) {
var cHeight = Math.max(doc.body.clientHeight, doc.documentElement.clientHeight)
var sHeight = Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight)
var height = Math.max(cHeight, sHeight)
return height
}
window.onload = function () {
var height = calcPageHeight(document)
parent.document.getElementById('ifr').style.height = height + 'px'
}
</script>
php的话也可以使用curl<?php
$homepage = file_get_contents('https://****.cn/');
echo $homepage;
?>
TGA: 技巧