Javascript Check for Preloaded Images

They have: 40 posts

Joined: Oct 2001

Hi,

On my site, the home page has a simple JS script to preload some images. Anyway, if the user enters the site at that page, life carries on. But if they happen to enter at another page, the images aren't preloaded, and it makes a bit of a difference.

I know I could preload the images on every single page of my site (yes, they're on every page) but is there some JS if statement that can check whether the images are already there, and if they are loaded, then don't load them, but if they haven't been loaded, then preload them?

Obviously, this mythical script would have to happen before the page was loaded!

Thanks

Busy's picture

He has: 6,151 posts

Joined: May 2001

what about a gobal javascript and use the onload in the body tag

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.