Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

pre-caching of images, movies and other files

lots of megs, clients under full control

11:52 am on Feb 27, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 10, 2004
votes: 0


I'm in need for a way to pre-cache lots of data on a client PC in a simple browser. When cached, the content will be displayed in the same browser. Because the internet connection available will not be the fastest on the planet, we need to precache de data.

Things that are relevant:

- Size of a single file may be up to 20megs
- Size of all files may be 500mb (probably less, but this size may occur.
- Amount of files will be about 200-300
- after some time some files will no longer be used (and probably be cleared from the cache automaticly).
- client PC is under COMPLETE CONTROL, we can do with them what we want. for instance, the cache size will be increased dramaticly.
- No stupid users involved (there is no keyboard on the pc, yes, really!)
- files may be images, movies, powerpoint presentations, flash-content, html-files.
- browser will not be doing anything else but displaying content from this server.

- What is the best way to cache this data in the browsers cache?
- How would I cache a moviefile? without starting the player.
- How would I cache a ppt-file? without starting to display it.
- Will the browser hold that much data; even when we increase the cache limit? (we may have to test this ourselves).
- Can we clear the cache from within a webpage? (remember: complete control of the browser).

I allready managed to cache a big set of images using a simple html-page with several img-tags on it. I'm not sure yet what to do with the movies and other files.

Javascript can ofcourse be used for this.
Any input is greatly appreciated.

[edited by: tedster at 5:48 pm (utc) on Feb. 27, 2006]
[edit reason] add opening poster to notices [/edit]

10:09 am on Feb 28, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 10, 2004
votes: 0

Allrighty then.

I've been searching online and trying a couple of things.

I managed to cache about 600 jpgs in both internet explorer and firefox. Total size would be about 100megs. Both stored everything just fine.

I simply loaded 10 jpgs at a time on a normal page, forced the size to 100x100px using width+height. Then jumped to the next page with a javascript refresh.
Using `onload` and `onerror` faulty url's were skipped (but tried) and succesfull urls were cached normally.
It takes some time, but that is no problem.

I'm now trying to cache the other filetypes, but I'm not having the same success.
How would I determine if a movie is fully loaded? onerror and onload don't seem to work in code like this:

<embed src='**fullURL**' name="jukebox" width="100%" height="100%" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" showcontrols="0"></embed>

I'm guessing I might need some other way to do this.

Any idea's?
note: it's no problem if the caching takes some time; as long as the files end up in the cache, we're happy.

11:02 am on Feb 28, 2006 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
votes: 4

I've been thinking about your problem: do the files change frequently (every few minutes), regularly (like every day) or at random intervals? Do you mind storing al the files on the client machine?

Personally if it was feasible I would consider running a web server directly on the client machine (eg. IIS or Apache) and the website referring directly to the files on the local machine (localhost). Then I would use a separate mechanism for downloading the files. If it was Linux on the host machine, I would look at something like rsync combined with a cron job (eg. every hour) which checks the central server and downloads only new or changed files. I'm less familiar with Windows but I'm certain there are similar mechanisms you can use.

11:45 am on Feb 28, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 10, 2004
votes: 0


The files don't change very often. I'm planning to make it in such a way that files will never change. But what file to be used will change; after some time a file will no longer be used. I expect that the browser will then remove the file from it's cache after some time (when it needs the space for other files).
This would allow us to tell the browser that it may cache the file for a very long time.

What files will be used (displayed on the screen) will change quite often; for this the pc will regularly make a request to the server what files to use.

We want to run as little software as possible on the client. Installing a webserver is definiatly more than we want to do. This is because there will be over 200 pc's where this has to be done. Simply to much work.

A solution known to work is to install a ftp-client on the pc and instruct it to synchronise on a regular basis. This won't allow us to change what to display on the screen when we want.
If caching of the browser works, this will be much better and it would allow us to change the content instantly.

That is why I'm currently investigating this solution to see if it works.
So I'm looking at ways how I can make a browser cache all sorts of files using only techniques that can be used in the browser itself (html, javascript, activex that will run without problems).

So how would I make a browser cache all sorts of files?