How to adjust the height of an iframe automatically

I’ve recently tried out a javascipt solution to resize an iframe to the make it the same height as the rest of the webpage. Don’t ask why I use iframe in the first place since I’m very well aware that all frames are evil.

The first solution I found was this one:
http://www.lost-in-code.com/programming/jquery-auto-iframe-height/
I was very happy when I found the above script. But after some testing I have found a problem with the script, the script seams to leak memory in IE6.
I’m not a javascipt-guru but at least I know that IE 6 crashed when I had two frames talking to each other for a while. After certain amount of clicks between the frames IE6 stopped responding. IE 7 and 8 didn’t have the same problem, but I still was not happy with the solution. Another thing: I don’t understand why they call it a jQuery-plugin since the script is totally independent of jQuery.

The solution I chose instead is this one:
http://sonspring.com/journal/jquery-iframe-sizing
It’s a bit different since it default works for every Iframe, but that could easily be changed of course. And this script is a real jQuery-plugin.

En reaktion på ”How to adjust the height of an iframe automatically

Lämna en kommentar