简体   繁体   English

根据iframe src网址的iframe内容动态调整iframe的大小

[英]Resize of Iframe dynamically depending on the content of the Iframe of the Iframe's src URL

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. 我想根据IFrame的src URL的内容动态调整iframe的高度,并且此src通过Webservice方法来实现。

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";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM