/ Published in: JavaScript
                    
                                        
Bind onload function to the iFrame and set the size of the iFrame to the iFrames loaded content.
In the example jQuery is used.
                In the example jQuery is used.
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
$("#modalIFrame").bind('load',
function () {
var newheight,
newwidth;
newheight = this.contentWindow.document.body.scrollHeight;
newwidth = this.contentWindow.document.body.scrollWidth;
$(this).height(newheight);
$(this).width(newwidth);
}
);
$("#modalIFrame").attr('src', url);
Comments
 Subscribe to comments
                    Subscribe to comments
                
                