I can't seem to get this caching to work - I have read everything I
can find and have tried several things, but I must be missing
something basic.
I have an image and I am changing the src through a timer which works
fine, but when I take the page offline and clear the browser cache,
the images break so the LocalServer is not serving them up for some
reason...
Here is what I call from a button click:
var localServer;
var store;
function storeForOffline() {
localServer =
google.gears.factory.create('beta.localserver');
store = localServer.createManagedStore('test-store');
store.manifestUrl = '/manifests/Patients.txt';
store.onerror = onSyncError;
store.oncomplete = onSyncComplete;
store.onprogress = onSyncProgress;
store.checkForUpdate();
}
Timer code:
var Nbr = 272;
setTimeout("DoTimer()",2000);
function DoTimer() {
if (Nbr == 276)
Nbr = 272;
document.images("ImgTest").src = "/Images/" +
Nbr.toString() + ".jpg";
Nbr += 1;
setTimeout("DoTimer()", 2000);
}
Image markup:
<img id="ImgTest" src="" width="40px" alt="" />
Manifest:
{
"betaManifestVersion": 1,
"version": "15",
"entries": [
{ "url": "Default.htm"},
{ "url": "/Images/272.jpg"},
{ "url": "/Images/273.jpg"},
{ "url": "/Images/274.jpg"},
{ "url": "/Images/275.jpg"},
]
}
The images run fine even when I take the web server offline, but if I
call up another browser and clear the browser cache, the images break
which tells me the images are coming from the browsers cache instead
of LocalServer. Where am I going wroing?