best method to preload images

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

best method to preload images

Post by amir »

I'm developing a site and i'm trying to stay away from using JavaScript functionality.

The site will contain alot of small, medium and large images and at the moment im using the commonly used function:

Code: Select all

MM_preloadImages()
that Dreamweaver uses...

I want some advice on what is best to use - a client-side preload script using above function or a server-side preload script using PHP?

Remember, my reason for this, is due to alot of web users these days have JavaScript disabled so hence why i'm trying to stay away from using it...

TIA!
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Post by kaszu »

What do you mean with "server side preload script"?

If you want to preload images (load images into memory and then displayed to the user without loading time, as i understand it), then it has to be on client side and only possible way i know is using javascript.

http://www.w3schools.com/browsers/browsers_stats.asp (90% has javascript turned on).
Last edited by kaszu on Wed Dec 06, 2006 4:46 pm, edited 1 time in total.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

btw there is a client side forum for this stuff.

I've done something like this in the past:

Code: Select all

<style type="text/css">
img .preload { display:none; }
</style>
<img class="preload" width="0" height="0" src="imagetopreload.gif" alt="a preloaded image" />
but the extra markup isn't particularly great. So I'm sure there will be better solutions.
Post Reply