Lunarpages Web Hosting Forum

Scripting Languages Hosting Help => JavaScript Support => Topic started by: aerph on April 21, 2005, 08:28:04 PM

Title: Check to see if preloading already done?
Post by: aerph on April 21, 2005, 08:28:04 PM
Our web page http://www.aerphotography.com preloads the same 18 'gif' files for the nav buttons (with rollovers) for 8 of the nine primary pages on the site.  The preloading of these small images is handled by a calling an external javascript (js) file which works well, but it runs every time a new page is loaded, in my mind, whether it's needed or not.  I think the preload should only happen once, but I can't control which page a user loads first.

Maybe this isn't a problem since I don't know if browsers actually repeat the preload if the images are already cached (?) ... but it seems to me that the script should contain an IF, ELSE to test whether the image variables are empty (not yet preloaded).  I'm new at this, have tried several approaches, but haven't yet succeeded.  Any suggestions?
Title: Check to see if preloading already done?
Post by: GMTurner on April 21, 2005, 09:18:40 PM
Chances are the images would be loaded from the cache after they visit the first page, so although the preload script runs multiple times, it shouldn't have that much of an effect on load time....