So here is my basic project to understand Offline App Cache:
- Load a dynamic php manifest (manifest.php)
- In my index.htm I have 3 html things:
1. log div that outputs erything that is happening to me
2. button that updates the manifest.
3. an image (image1.jpg)
- What i want is to test an auto-update engine, wich means: i download everything first time. replace the manifest, replace the image with a diferent one (same name tough).
My problens:
1) my manifest is behaving weird:
- Code: Select all
<?
header('Content-Type: text/cache-manifest');
echo "CACHE MANIFEST\n";
echo "./image1.jpg\n";
echo "# r 1 \n";
?>
It works like that fine, BUT If I try to change the last line (# rev 1 \n) to a place bellow the "cache manifest" it stops working! Thats weird..... when i try to load the manifest i get an error triggered by the:
// The manifest returns 404 or 410, the download failed,
// or the manifest changed while the download was in progress.
appCache.addEventListener('error', handleCacheError, false);
2) I want to replace the image after the updateready event triggered.
When I use my code it reloads the cache but the image remains the same even after swapCache. Do i need to do something after swapcache to replace the image on the screen? If the image has the same name doesnt the browser updates the image with the new one cached?
If not, Can someone point me to a code that replaces an old image (previously cached) with another new image (with the same same). I tryed to use the:
- Code: Select all
appCache.swapCache();
When I use the swapcache it really change the image in the cache but not on the screen, if i reload the page the image changes.....
Thanks To everyone!