123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|123|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Web Development -> Cache

Thu, 08 Mar 2007, 14:17
ingenium1
I have a website with a lot of images... I want the browser to copy all the images in the cache when the user opens the home page to browse the website faster... is it possible?
Example: With flash you wait some seconds to allow the machine to load all the images of the flash program, I want to do somenthing similar in Html,php ecc...

P.s. I have no problem on IE because it automatically loads in the cache the pages he browses

-=-=-
Roger Federer is go(o)d.
But he is not alone.

Just relax... sometimes there's no need to argue.
Thu, 08 Mar 2007, 15:03
Jayenkai
Technically, all duplicate images shouldn't reload. For example the icons all around this site are cached automatically, so when you go to the next page, they're ready and waiting. (Usually.. sometimes it reloads them, not sure why!)

If you mean larger images, then I'd prefer to have my web pages load as I see fit, as opposed to waiting 2 or 3 mins for the thing to download everything, before I can start reading things.

-=-=-
''Load, Next List!''
Thu, 08 Mar 2007, 15:04
ingenium1
I am not asking if you would... so is it possible?

-=-=-
Roger Federer is go(o)d.
But he is not alone.

Just relax... sometimes there's no need to argue.
Thu, 08 Mar 2007, 15:46
Jayenkai
Depending on what it is that you're actually using it for, this might help.

-=-=-
''Load, Next List!''
Fri, 09 Mar 2007, 00:03
shroom_monk
I'm not sure what's in Jay's link, but it is definitely possible with a JavaScript pre-loading script. I would post it, but I have to go to school now! I'll post it after.

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Fri, 09 Mar 2007, 11:31
shroom_monk
OK, this is based on the script from 'Javascript in Easy Steps':


Just stick that inbetween the <head> </head> tags, so it executes when the page loads.

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Fri, 09 Mar 2007, 12:48
ingenium1
I don't understand that code... xD...
Tell me if those comments are right:


-=-=-
Roger Federer is go(o)d.
But he is not alone.

Just relax... sometimes there's no need to argue.
Fri, 09 Mar 2007, 12:56
shroom_monk
OK, all your comments are fine. I will explain the .src bit.

Basically, to load the image, it has to be downloaded into an Image object. So, the preload array has each of its elements set as this object. Objects have properties, and .src is a property of an image object that stores the location of the file.

Of course, to use this program you don't need to worry about that bit. All you have to do is add your images into the array at the top, and the rest will work on its own.

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Fri, 09 Mar 2007, 13:01
ingenium1
well thanks man!
Fri, 09 Mar 2007, 13:18
shroom_monk
You're welcome!
Fri, 09 Mar 2007, 20:25
Stealth
But wont the array be reset when you load a new page?

-=-=-
Quit posting and try Google.
Sat, 10 Mar 2007, 00:22
shroom_monk
Yes, the array will be reset, but the images will still be cached. Basically, that script tries to assign the images to those objects in the array, which forces the browser to download them. When it downloads them, it caches them, so they will still be there when you reload the page. Although, flicking through multiple pages with different images could present problems... but the script can be tweaked. It is designed for single pages.

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Sat, 10 Mar 2007, 23:09
power mousey

yeah,

listen to shroom. He knows his stuff.
coding mushrooms and all too.

true.
Sun, 11 Mar 2007, 00:04
shroom_monk
Thank you mousey!