Click here to Skip to main content
15,894,540 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to set iframe height on runtime according to container page size.
means if the container page size is 1000px,then iframe size should be adjust 1000px.
Posted
Comments
Zoltán Zörgő 13-Apr-13 2:31am    
You can do this only if inner and outer frame source is the same domain or they have cross domain trust enabled.

1 solution

Try this!!

XML
<iframe id="Iframe1" src="~/Aspx/Popup/PanelMembers.aspx" onload="setSize()"runat="server"></iframe>

C#
function setSize() {
           var iframeElement = parent.document.getElementById('Iframe1');
           var height = document.documentElement.clientHeight - 100;
           iframeElement.style.height = height + "px";
       }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900