View Full Version : Prototype Trying to delay new window loads for performance

02-03-2011, 02:43 PM
Hi guys - I am building an html/javascript web page and I am using prototype windows to display various stuff. I currently have 25 new prototype windows loading up when you open up the web page and as you can imagine it takes 15-20 seconds before any of the windows content begins to appear.

Does anyone know of a way to use javascript to only load say 3 new prototype windows and display them on the page and then like 5 seconds later load the next 3 and so on?

I have been messing around with this:
setTimeout("launchGroup2()", 5000);
but no luck yet. I know EJB programming but never learned much Javascript. It seems like all the functions in my .js file are executed when I include it in my html page and it doesn't return control to the browser until everything in the .js file completes executing. Am I missing something?

Thanks for any advise!:confused:

02-03-2011, 05:23 PM
That's what you use events and callbacks for. If you don't know how long a window will take to load, setTimeout is a flawed approach. I don't know anything about Prototype windows, but I'm pretty sure they provide some sort of callback option to execute code once the window is loaded.