首页 > 为什么iframe调用网页不加载呢?

为什么iframe调用网页不加载呢?

<iframe src="http://www.163.com" style="margin-left: 400px" width="500" height="600"></iframe>

这段代码有问题吗,chrome下能加载,firefox下怎么就不加载呢

这是firefox的截图


Firefox support 官方有一个答案,看看能不能解决你的问题。
https://support.mozilla.org/en-US/questions/737230


有一种可能就是你的附加插件,譬如说,adBlock把这个当做广告拦截了。
我使用

<script type='text/javascript'>
//页面加载完成,单独加载iframe
//我在iframe页面中写了alert(1)
    $(function(){
                alert(2);
                var _theframe = document.getElementById("theframe");
                _theframe.contentWindow.location.href = _theframe.src;
                });

</script>

最后的结果就是先弹出1,再弹出2,然后出现iframe内容,最后全部消失。
我禁用了adBlock就好了,我才知道是这个原因。

【热门文章】
【热门文章】