Resize iframe, after content change
I need to include a Wordpress blog in an iframe. Both containing document and WP is on the same domain.
Leaving aside some issues with Firefox, I have got this to work on initial load in Chromium;
<iframe id="wpIframe" src="<?php echo $wpUrl; ?>" frameborder="0" scrolling="no" height="3850px" ></iframe>
Wrapper has a heigth of 100%.
var the_height= document.getElementById(iframeName).contentWindow.document.body.scrollHeight;
//change the height of the iframe
document.getElementById(iframeName).height=the_height + 'px';
I can see in Chromiums dev-tools (F12) that the iframe has had it's height changed.
But, if I now click on an article ("read more") in the iframe, the new content is loaded inside the iframe, but now the iframes height is not changed!
Is there some other event than load that I should also bind the function to?