How can I dynamically change the height of an iFrame containing a Pardot form? I have a Pardot form that is placed on a page in my site via iFrame. I have tried a number of ways to dynamically resize the iFrame depending on the size of the form. When a user submits the form, much of the data is stored and the forms becomes shorter the next time the page is viewed. The iFrame code is as follows:
<iframe
src="http://go.pardot.com/..."
width="100%"
type="text/html"
frameborder="0"
allowTransparency="true"
style="border: 0" scrolling="no"
id="iframe"
onload="javascript:resizeIframe(this);">
</iframe>
The javascript is as follows:
function resizeIframe(obj)
{
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
}