Preloading Images

They have: 5 posts

Joined: Jul 2003

I have been looking into the preload images javascript function and I dont see the benefit of doing that if the browser already caches the images anyway. I see it alot and was wondering if it was worth doing?

Your thoughts?

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Depends on the purpose of the image. Smiling

Preloading images is useful for when you need an image to show up instantly -- like a rollover/button image. If you don't preload such an image, chances are the user will find the rollover action lags.

True, once cached, preload won't be necessary, but there are the first-time visitors, and users who keep tight caches, to bear in mind.

There's no point preloading most other images that you'd usually find on a page. Smiling

They have: 5 posts

Joined: Jul 2003

Cool, Thanks for the reply Smiling

I do have some rollover images and I have seen what you are talking about. So do I preload both images on the rollover or just one of them?

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Since the initial image will load naturally with the page, no need to preload it. Only preload the "hover" image. Smiling

Busy's picture

He has: 6,151 posts

Joined: May 2001

I used preloads on an old site of mine, I needed it as the contents on the second page was over 200kb, but thing was I wasn't able to control which page people came from, if they went directly to the second page the preloads were useless and they had to wait until it all loaded.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

I think pre-loaders are only really used for rollovers, if a user went to busy's site and only wanted to look at the first page they're going to get pretty miffed if the second loads automatically...Especially if they're on a 56k connection and have another download going.

In general pre-load what you KNOW is going to be needed, but is not going to be downloaded "naturally"

a Padded Cell our articles site!

taff's picture

They have: 956 posts

Joined: Jun 2001

Preloaders can also be used for graphic-intensive situations such as photo galleries, the logic being that one big initial "loading, please wait" is preferable to the sluggishness of waiting for each image to load as they are called upon.

Yes, the browser stores an image in its cache but it has to be loaded once to do so - that's the whole logic behing preloading.

.....

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.