Click here to Skip to main content
15,064,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

I'm new in web programming and now i got a chance to use iframe in my web app project.I'd like to resize iframe which is second level frame according to its content size.How do i achieve it? Anyone wants to help me out? Thanks in advance.
Updated 6-Sep-14 10:24am

Give CSS Style Using Code Behind or Using JavaScript or J-query.

Ex 1.


$("#iframe").width($("#content").width()) ;
$("#iframe").height($("#content").height()) ;



Ex 2.


iframe.Width = content.Width
iframe.Height = content.Height

I alret content height and parent frame's height.They are the same value.But i can't see full content in parent frame.
function IFrameResize(obj)
    var contentHeight;

    contentHeight=obj.contentWindow.document.body.scrollHeight; contentHeight + 'px';
    window.parent.document.getElementById("parentframe").style.height = 
    contentHeight + 'px';

I call that above function in child frame onload event.
Parent frame need to be resized according to child frame content size.
How to achieve it?
Thanks in advance.

I can see my content when i press middle mouse click and all the way scroll down to bottom. So content is just hidden. Is it scrolling problem or something? 
I think it almost there already.
Show me your code or give me the source code of project or anything. I will solve it.

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