Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hello, thanks to this site and it's helpful nods in the right direction, I'm plodding along quite nicely. I managed to make a functional website with all my graphics, my imbedded videos, an image gallery, and a javascript random theme function.

Now that I've got the basic functionality and scripts in place for various aspects, I now want to redesign this in CSS so I can not only template my site, but also to keep aspect ratios consistent between browsers and resolutions.

TL:DR version - is there a script that will allow me to create a session variable for a user, and while that variable is active, it'll download the images and backgrounds i want to display across the site into the cache?

ie. someone is on the home page; now, my random theme consists of about 9 different images, of approximately 300kb each. from the 9, 3 random ones are chosen and placed into 3 seperate < div >'s, 2 down the sides and 1 at the top.

By allowing a 'background' download of the images into the cache it'd allow the random background feature to be near enough instantaneous once they've finished navigating the home page...

Thoughts?
Cheers guys!
Posted
Updated 2-Mar-11 5:14am
v2

1 solution

This question seems to be asked a lot. Let me try to understand you first. What you asking is that you want to download images into the client machine without the user action. Right? Of course you said cache, which I understood as their browser cache.

Simple answer is no you can not do it. The only way you can have it downloaded is if you page references the image. Let us take a nice walk by the side of the lake at sun set while discussion this issue, wait a minute, I know you intended to increase the performance of your application, but if that is possible, how would be the client able to to prevent his machine from some malicious person dumping all kinds of, you know what I mean, into their cache?
 
Share this answer
 
v3
Comments
renegmc 2-Mar-11 13:58pm    
Hmm, you raise a very valid point. thanks for posting.

So what would you say would be a way of me optimizing page load times with a fairly graphic intensive site?

I don't want to lose quality of images, but I don't want it to take an age to download my site.

Do you think this could be achieved using CSS sprites?
Yusuf 2-Mar-11 14:16pm    
Well it is very hard to suggest something without complete knowledge of what the issue is. But let me take a crack at it. To me the best solutions are those which are data driven. What do I mean by that. It seems to be your are jumping the ship, just because you have many [high quality images]. First conduct a battery of stress tests simulating different bandwidths. Then analyse your data. May be you will find that it is not an issue at all. But if you find an issue, then you can attack just that one.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900