Log in

View Full Version : Auto-resizing IFrame?



Moglizorz
04-16-2007, 11:26 AM
I tried a script on this site, but it didn't work :confused:

I want the IFrame to automatically change height depending on what is inside it. I tried 2 different ones on this, one didn't work, and the other was not able to resize for pages that are not on the same domain.

Does anyone have a working script that will work for me? :D

Thanks.

Veronica
04-16-2007, 03:10 PM
Which scripts did you try, ie their URLs? Also, what browser are you using? The scripts to re-size the iframes can be buggy depending on the browser.

Also - no re-sizing script will work if the page containing the iframe has a different domain from the iframe. Due to cross-browser security issues, things like links will work, but javascript that involves accessing data (such as page height) will not.

But send the URL's of the scripts you tried - there may be an updated one that will work better, so long as your pages are on the same domain.

Moglizorz
04-21-2007, 10:47 AM
I can edit the html on the page inside my IFrame, but it is not on the same server, or domain. Is there any javascript I can add to the page inside the frame that sends to the page holding the frame to calculate the size or something?

Veronica
04-21-2007, 02:45 PM
Not that I'm aware of. I had a similar situation, but kept running into the cross-domain and cross-serve issue.

mburt
04-21-2007, 08:35 PM
Just create the layout inside the page that the iframe points to, to have 100% height (without padding/margins, that will cause it to overlap).

Veronica
04-21-2007, 11:32 PM
100&#37; height layout - tried that with <body onload="resizeTo(document.body.scrollWidth,document.body.scrollHeight)" style="height:100%">
It made the page full-length when it was openned by itself in IE (tho not in FF), but then didn't work when the frame was loaded into the iframe. Which was the whole point.

Also tried cookies. Ditto. Concluded it's not possible to run the DD re-size script across different domains. Anyone have an example otherwise?