Click here to Skip to main content
14,392,692 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi,

i am using i frame i want to resize the iframe height according to content.but the thing is frame is loaded only once and when the page containing the iframe is opened as modal pop up, the modal pop containing the iframe does not have the height according to the content any idea ?
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

u can try this

<iframe id="i1" src="Home.aspx" runat="server"></iframe>
i1.Attributes.Add("Height","500");
   
Comments
kjsl2k9 7-Jul-11 6:33am
   
hi,

i want to set of iframe height according to the source page height not static.
Rate this:
Please Sign up or sign in to vote.

Solution 2

Hi,

Try this function in your js.

function setIframeHeight(iframeName, IsCallFromIFrame) {

    if (IsCallFromIFrame) {
        iframeEl = parent.document.getElementById(iframeName);
    }
    else {
        iframeEl = document.getElementById ? document.getElementById(iframeName) : document.all ? document.all[iframeName] : null;
    }
    if (iframeEl) {
            iframeEl.style.height = $(document).height() + 10 + "px";
            return;
        }
}


Regards,

Anand
   
Comments
kjsl2k9 7-Jul-11 6:34am
   
Am not using jquery so $(document).height() is no use any other idea
Anand Ranjan Pandey 7-Jul-11 7:08am
   
is there any specific reason not to use jQuery ?

document.getElementById(iframeName).style.height = // some height


is also working f9 with me.

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100