简体   繁体   English

单击iframe内容页面中的显示隐藏按钮时,iframe高度不会自动增加

[英]iframe height not increasing automatically when clicking on show hide button in iframe content page

i frame height is not automatically increase or decrease when clicking show hide button in i frame content page. 单击i框架内容页面中的显示隐藏按钮时,i框架高度不会自动增加或减小。 how can i solve this issue? 我该如何解决这个问题?

<iframe class="" id="ds"  seamless="" src="demo.aspx" style="width:100%; border:none; height:100%;"></iframe>
$("#ds").load(function () {
$(this).height($(this).contents().find("html").height());
});

This is a very common issue: 这是一个非常常见的问题:

  1. You need to have control of both the servers ie the server from which iframe is loaded and the one in which iframe is present. 您需要控制两个服务器,即从中加载iframe的服务器和存在iframe的服务器。

  2. You cannot set iframe height as it is a cross domain issur=e and so it does not allow change in its height (see your console whiile loadind page it will show the error) 您无法设置iframe高度,因为它是跨域issur = e,因此它不允许更改其高度(请在控制台上查看loadind页面,它将显示错误)

  3. You need to work around using post messeage: refer https://css-tricks.com/cross-domain-iframe-resizing/ 您需要变通使用邮政信息:请参阅https://css-tricks.com/cross-domain-iframe-resizing/

play around with post message and you will be able to set height of the iframe then 播放帖子消息,您将可以设置iframe的高度,然后

Thanks 谢谢

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

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