如何让xxx.com的首页是yyy.com的首页,他的思路是用iframe,好吧,我们就用他的。如何实现完整的调用的。
方法一:
<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获取其他网站内容的方法
<?php
$homepage = file_get_contents('https://****.cn/');
echo $homepage;
?>
php的话也可以使用curl
jq的话,可以用load的方法
© 版权声明
- 1、 本站的文章部分内容均来源于网络,仅供大家学习与参考,如有侵权,请联系站长:QQ932926588,邮箱同号。
- 2、 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
- 3、 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
- 4、 本站资源大多存储在云盘,如发现链接失效,请联系我们会第一时间更新。
THE END






















暂无评论内容