View Full Version : How to get rid of vertical scrollbar for dhtml window

06-14-2012, 12:01 PM
1) Script Title:

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe problem:
I am using the dhtml window to show content in our application when user clicks on a link. Initially, the page content is not known and it is dynamically loaded. The option used for content source is "Iframe". I do not want the vertical scroll bar to be shown and the div should resize itself according to the content.
It would be helpful if somebody can help me with this.

06-14-2012, 05:09 PM
Hmm is the page inside the DHTML window on the same domain as the page launching the DHTML window, or an external URL (ie: http://google.com)?

06-18-2012, 05:44 AM
The DHTML window and the page launching it are in the same domain.

06-18-2012, 08:02 PM
One approach is to dynamically resize the DHTML window after the contained page has loaded, by getting the dimensions of this page. This has only been tested in FF so far, but inside dhtmlwindow.js, try adding the code in red below after the following existing line:

window.frames["_iframe-"+t.id].location.replace(contentsource) //set location of iframe window to specified URL
this.addEvent(window.frames["_iframe-"+t.id], function(){
var wbody=this.document.body
t.setSize(wbody.offsetWidth, wbody.offsetHeight)
} catch(e){}
}, "load")

06-20-2012, 11:48 AM
Thanks for the code. But this does not work in IE and Safari. If you can share the code which shall work across these browsers.

06-21-2012, 05:35 PM
Hmm might still be a work in progress, but try the below modified .js file.

06-22-2012, 12:35 PM
The attached file also did not help resizing the iframe.