View Full Version : Dynamic iframe II slowdown problem

06-22-2006, 12:05 PM
Hi all!!

My first ever post to these forums so be gentle! :)

I am using the dynamic iframe script II on my integramod (phpbb) website. I am using iframes as a wrapper for content inside portal pages on the main site. In these wrappers I have sub-sites (all of which are on the same domain). So, the dynamic resizing works brilliantly apart from one small problem.

Lets say i go to a portal page with the iframe on it. The portal page loads and then the iframe is populated with the subsite. If I then start to navigate around the subsite within the iframe all is well for the first 15-20 clicks (ie, the frame resizes for the new content). After this though the resizing of the frame starts to take progressively longer and longer with every click until it appears to hang (if you wait long enough it does come back). If you then reload the whole portal page it will be fine again for another 20 or so navigations and then start to slow down again.

This happens on all 4 of the subsites I have running in the iframes. All 4 subsites work fine when navigated around directly (not in the iframe).

it seems to me there is some sort of recurring loop somewhere but not being a javascript expert (in fact - i am a total novice) I have no idea where to start looking!

Any suggestions greatly received!!!

06-23-2006, 08:19 AM
Give us a link to your site and tell us what browser(s) you are experiencing this in.

06-23-2006, 03:17 PM

I have sent you an email with a test login to the site

Thanks!! :D

06-24-2006, 08:21 AM
Yeah, I see what you mean, big time slow down in IE. No problem in FF. I didn't test any others. I Thought it might be a memory problem so I tracked memory usage in Task Manager. No real problem with memory usage but I noticed actual CPU usage was spiking and then getting pegged a 100%. The more I loaded pages into the iframe in IE after that the longer CPU usage would remain pegged at 100% and this corresponded exactly with the amount of time that the frame was blank. I then had a look at your source code and saw that you had commented out this line:

//currentfr.detachEvent("onload", readjustIframe) // Bug fix line

Those two little red slashes at the beginning make it a comment. Why did you do that? I'm like 99% sure that this is the problem as that is an IE specific line designed to prevent multiple instances of the resizing event. Without that line, each time you load something into the iframe an event gets attached to it. After 20 loads, you have 20 events all firing at the same time. Almost has to be it. Just remove the red slashes and you should be fine.

06-25-2006, 02:50 PM

Uncommenting that line has indeed fixed it!! Many thanks :)

I am by no means an expert on this stuff :rolleyes: In fact this is my first site build so most of it was learnt from forums, web tutorials and trial and error! I actually got the dynamic drive code from a forum and that line was already commented out. I will try and remember where I got it and post a commment about this.

Thanks again for you help!!