Click here to Skip to main content
15,916,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,

I am working on a offline Html5 web application. In this i use the HTML5 APPCACHE for offline purpose. I want to handle this cache functionality on user will. Means whenever a user visit this web application he will get the promt msg to change version if he choose to no then this application should work on old version of appcache
(* After refreshing or reloading this web page should work on old version)
Now if user choose yes the his application must use the new version.........


I have search a lot for this put i can only listen the events of this appcache
see this....

http://www.html5rocks.com/en/tutorials/appcache/beginner/[^]

Please if anyone can help me please do it i need it seriously....

Thanks in Advance
Posted

1 solution

1. Browser checks if appcache have been modified on page load. Usually if you have changed only some content in existing files, browser will not detect that cache needs to be reloaded.

2. If you want force updating, use update method of application cache.

JavaScript
window.applicationCache.update()


Important: The update() method only updates the cache—not the web application or anything that is loaded. The easiest way to update the page when the cache is ready is by reloading it:

location.reload();
 
Share this answer
 
Comments
vinu2528 1-Aug-13 2:31am    
Sorry Vyacheslav but this method only work when there is change in appcahe file but i want to update the appcache even if there is no change in appcache file......

And if this cant possible is there any way to stop updating appcahe files by browser even if there is change in appcahe file....
Vyacheslav Voronenko 1-Aug-13 3:45am    
Prior writing comment, have you tried code above with activated google chrome developer tools console?
vinu2528 1-Aug-13 6:18am    
ya i already tried all the functions of appcahe like swapcache(),update() all these...
Vyacheslav Voronenko 1-Aug-13 6:48am    
My experiments show that it effectively forces cache reload. In addition you might want to introduce some versioning in your cache manifest file (for example calculate hash of all included files, or smth like this) to make sure that in case of any file change manifest file will be definitely updated.

Dirty example:

IsFile() &&
(pathinfo($file, PATHINFO_EXTENSION)!='appcache') &&
(substr($file->getFilename(), 0, 1) != ".")
)
{
echo $file . "\n";
$hashes .= md5_file($file);
}
}
echo "# Hash: " . md5($hashes) . "\n";
vinu2528 5-Aug-13 2:45am    
First of all Thanks a lot Vyachesiav Voronenko.

But i thing u are not getting my problem.
Now look whenever we changes the cache file our browser download all the new files ok,
Now here is my question come HOW TO ABORT THIS PROCESS when there is some changes in cache file. Means how to call this appcache.Abort() function.

I have used this appcache.abort() ,but it seems it doesnt work.

Hope now you understand my problem

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