根据Iframe的src网址的Iframe内容动态调整Iframe的大小 [英] Resize of Iframe dynamically depending on the content of the Iframe of the Iframe's src URL

查看:396
本文介绍了根据Iframe的src网址的Iframe内容动态调整Iframe的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据IFrame的src网址内容动态调整Iframe的高度,而此src是透过Webservice方法传送的。

I want to resize the height of Iframe dynamically on the content of the IFrame's src URL and the this src is coming through Webservice method.

请帮助任何人。 .thanks

please help any one..thanks

推荐答案

当网站来自同一个域时,您可以使用此代码,尽可能扩展框架:

When the website is from the same domain, you can use this code, which expands the frame as much as possible:

var frame = document.getElementById("name_of_iframe");
var contentframe = document.frames["name_of_iframe"];
contentframe = (contentframe.contentDocument||contentframe.windowWindow.document).body;
frame.style.height = contentframe.scrollsetHeight + "px";
frame.style.width = contentframe.scrollWidth + "px";

这篇关于根据Iframe的src网址的Iframe内容动态调整Iframe的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆