Using appcache with php & database
I am developing web applications using jQuery Mobile. These apps use a database to get prices, etc. (Using php). I am also using appcache to be able to use apps offline.
<html manifest="manifest.appcache">
This all works great. But when I'm online, I don't want applications to use appcache. How to do it?
I can check if I am online / offline by checking if the file is available:
$.ajax({
url:'http://someurl.com/online.txt',
type:'HEAD',
error: function()
{
console.log('offline');
},
success: function()
{
console.log('online');
}
});
However, I cannot find anything that the page does not use appcache ..
Did I miss something?
+1
source to share
1 answer
Step by step solution:
- Check if you are online / offline
- If you are online, run a php script that adds # to the end of the appcache manifest. This is because the cache will be updated if the manifest has changed.
- Minimize the cache and refresh the page
After I finally got it working, I noticed that it doesn't work in Firefox due to the swapCache () function. ( https://bugzilla.mozilla.org/show_bug.cgi?id=769171 ) Luckily my users are not using Firefox.
+1
source to share