Possible Duplicate:
Resizing an iframe based on content
I'm loading an iFrame and want the parent to automatically change the height based upon the height of the iFrame's content.
To simply things, all pages belong to the same domain, so I shouldn't run into cross-site scripting issues.
Try:
My solution, (using jquery):
In IE 5.5+, you can use the contentWindow property:
In Netscape 6 (assuming firefox as well), contentDocument property:
This solution worked best for me. It uses jQuery and the iframe's ".load" event.
Actually - Patrick's code sort of worked for me as well. The correct way to do it would be along the lines of this:
Note: there's a bit of jquery ahead:
This is the easiest method i have found using prototype:
Main.html:
content.html:
This seems to work (so far) in all the major browsers.