Preloader

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
mikusan
Forum Contributor
Posts: 247
Joined: Thu May 01, 2003 1:48 pm

Preloader

Post by mikusan »

Hi, i am looking for a site preloader... similar to flash preloader, but it has to preload all of my graphics before it displays the site... now PHP would be the best solution, but i am openminded to anything...

Thanks
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

but, im thinking, php is server side... what you want to achieve is client side, or not?
User avatar
mikusan
Forum Contributor
Posts: 247
Joined: Thu May 01, 2003 1:48 pm

Post by mikusan »

Yes... well perhaps i am thinking too fast ahead of me... but i would like to load all the images to the clien't's temporrary cache... i guess PHP is not the one to do tis but how would i do it...anyone know?
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

I beleive many sites use JavaScript to handle this. In fact almost any JavaScript book has an example script for it.
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post by cactus »

Possably OT, but, in my experience preloading images is only useful when there are a lot of small images (file-size) that are going to be needed on a subsequent page.

Personally, I would question why you need to force your client (user) to wait for the preloading to finish before he/she sees the page (dependant on browser too).

Just an observation.

Regards,
User avatar
mikusan
Forum Contributor
Posts: 247
Joined: Thu May 01, 2003 1:48 pm

Post by mikusan »

Peronally i don't like them never used them... but since i am building sites for others sometimes people don't quite listed to your suggestions and want to do it "their" way... this customer saw somewhere this thing and wants it at all cots... well... yea... thanks guys I will look into some Java Script for this one... 8O
User avatar
HungryMind
Forum Commoner
Posts: 41
Joined: Fri Jun 20, 2003 10:33 am
Location: Alameda, CA

My attempt at a bit of help.

Post by HungryMind »

I think this may work, I am not sure, though. Someone correct me if I am wrong or if I forgot something. This is javascript, by the way.

Code: Select all

<script language="JavaScript">
<!-- hide me

var count = 0;

function preLoad() &#123;

home = new Image();
home.onload = loadCheck;
home.src = "buttonportfolioover.gif";

home = new Image();
home.onload = loadCheck;
home.src = "buttonsfbayareaover.gif";

home = new Image();
home.onload = loadCheck;
home.src = "buttonlongdistanceover.gif";

home = new Image();
home.onload = loadCheck;
home.src = "buttonpressandrelatedover.gif";

home = new Image();
home.onload = loadCheck;
home.src = "buttondecorativepaintingover.gif";


&#125;

function loadCheck() &#123;

count++;
if (count == 2) &#123;
alert("All images loaded properly.");
&#125;
&#125;
// end hide -->
</script>
EDIT: Of course, you have to change the image names. I basically took this straight out of one of my past sites. Tell me if this helps.
Post Reply