Forum Moderators: open

Message Too Old, No Replies

setTimeout limit?

         

carlanga

2:44 am on Nov 7, 2002 (gmt 0)

10+ Year Member



Is there a limit on the number of concurrent times out for IE? I have a page that loads many iframes (could be more than 100).. for which I setTimeout to wait if the iframes completely loaded their contents. But IE seems to choke .. since it uses 100% of CPU resources and never renders the page.

Please advice.

C

Purple Martin

4:39 am on Nov 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try setting the wait time to a higher value. If you have it set very low (eg every 1 millisecond) then the computer is checking continously with no time inbetween to do anything else (like load your iframes). If you set it to, say, 2000 milliseconds ( = 2 seconds) then you computer has 2 seconds in between each check to do the work of loading the iframes.

If this doesn't help, the computer is probably choking on loading the iframes, not on checking to see if they're loaded.

carlanga

4:49 am on Nov 7, 2002 (gmt 0)

10+ Year Member



my script executes on the onLoad event on each iframe. If I remove such a call it loads all the iframes fine. The timeout that I give is exactly 2000 millisecs or 2 secs. So my guess is the number of concurrent time outs.

any thoughts?

Purple Martin

11:14 pm on Nov 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does this mean every iframe calls the same function, which then calls itself every two seconds? That seems like a lot of unnecessary calls.

Here's how I might try it. Have a variable in the top level file for each i-frame that is set to false:
iframe1 = false
iframe2 = false
iframe3 = false
etc.

Then each iframe sets it's variable to true when it loads. For example iframe number 42 has the following:

onLoad="top.iframe42=true"

My function sitting at top level checks all the variables like this:

function myFunction() {
if ( iframe1 && iframe2 && iframe3 ... etc ) {
// do something here
}
setTimeout("myFunction()", 2000)
}

And I call my function just once from the onload in my top level document like this:

onLoad="myFunction()"

HTH