Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: open
SiteA has an iframe showing content from SiteB
You need a script on siteB to resize the iframe in which it's being shown.
Or, is it that you can't predict how big the content on SiteB is, and you'd like your iframe to resize itself to fit snugly around it?
Either way, information about B has to communicate with A. If the two pages A and B are in the same domain, then it's totally possible. If they're not... then tough luck. :(
This is a problem I have struggled with repeatedly with no resolution. I don't think it's possible though I'd like to be proven wrong.
What was the suggestion using fragment ids? There could be possiblities there I haven't explored... Can SiteB add a frag to the URL, and does that change the src attribute of the iframe it's in? hmmm I feel an experiment coming on
PS:Sorry if i have any mistakes, i'm Bulgarian.
Site B (in the iframe), onload, measures its own size. then it changes its location.href from "http://www.siteb.com/page.htm" to "http://www.siteb.com/page.htm#height:300px"
Site A (the parent page) sees that change - how? - and changes the height of the iframe to 300px
You could determine the change in the url by hooking on the window's onfocus event handler (and calling targetWindow.focus()), or by simply using window.setInterval. I had troubles with the first, so I made it with the second, but could not find a way around the problem of junk history entries.
Actually you could bypass the whole problem of cross-domain security by using mod_rewrite with proxying enabled? You could eventually make SiteB look like as if it would be part of SiteA, they would be situated in the same domain - at least that's what the browser would see...