Auto height iframe content script
Hey. I'm making a wordpress theme that will have a SMF forum incorporated into one of the pages.
I've decided to use an iframe that calls in the forum (which is in the same domain), after trying several of the auto height scripts, including ones I used before with success, I got nothing.
I'm not sure if it's a wordpress thing, but the scripts I'm so familiar with just don't want to work.
Since forums change their height with all the different pages, this is an essential script for me. The only script (a new one) that somewhat works is the following:
which eventually gets called with:
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
obj.style.width = obj.contentWindow.document.body.scrollWidth + 'px';
inside the iframe tag.
Now, this seemed to work just fine, but now the height of the page gets added the more I browse. if for example i go to a topic with a lot of replies (meaning, a long page height), and I browse back to the index page, that extra height isn't gone.
You can see what I mean here:
I was wondering if there is something that can be done to this script to stop this and properly resize the iframe.
The other script I've used was:
which worked great as you can see here: