HTML5 Offline Application files using Cache manifest never get updated

I have developed an HTML5 mobile app with jQueryMobile and I am trying to provide a standalone function to allow users to use the app without an internet connection. I am following this tutorial: http://www.html5rocks.com/en/tutorials/appcache/beginner/

  • The manifest file has been created.
  • Added mime-type / cache-manifest type manifest to .htaccess file.
  • Pages contain a manifest file in an HTML tag.

I am testing it and it seems to work. When I'm offline, web navigation between my pages still works. However, I find two main problems:

1) Offline works when I get a connected app and then shutdown it. When opening the app from the browser of the mobile device, pointing the URL in the address bar without connecting, the web app does not load! Although I previously visited the web app.

2) Web application files are never updated. For example:

  • I am changing something in the encrypted CSS file.
  • I am updating the comment in the manifest file to tell the application to update its files.
  • The CSS file is never updated. The current version is the previous one.

I am trying to detect cache status from JavaScript to control page refresh:

function checkCacheVersion(){
    var webappCache = window.applicationCache;
    if(webappCache){
        //0-> unchached
        //1-> idle
        //2-> checking
        //3-> downloading
        //4-> updateready
        console.log('Cache state= ' +  webappCache.status);
        if(webappCache.status == window.applicationCache.UPDATEREADY){
            console.log('[Cache] There is an update waiting for reload');
            webappCache.swapCache();
            location.reload();
        }
    }
}

      

However, the cache status is always "idle" status. What does it mean? As far as I understand, I would get "Uncached" status if the cache was not configured properly. Right?

On the other hand, the sample CSS file is only updated if I remove it from the manifest file. This way the browser detects that the file is not being caught and receives it correctly (I mean the cache is set up correctly, right?).

Could you help me figure out where the problem is? Many thanks!

Sergi

+3
html5 jquery-mobile browser-cache


source to share


No one has answered this question yet

Check out similar questions:

70
IOS offline app: downloads my manifest but doesn't work offline
52
How to properly invalidate HTML5 cache manifest for online apps or offline apps?
7
HTML5 Software Cache Expiration
3
Offline web application using header control cache?
2
HTML5 Javascript file caching for online and offline use
1
Limiting the offline cache cache for Firefox Mobile
0
Apache is not assigning correct MIME type for HTML5 offline .manifest file
0
Use HTML5 cache manifest to improve performance?
0
Cache-manifest: offline, replace all pages with one "Are you offline" page?
-1
HTML5 offline cache update



All Articles
Loading...
X
Show
Funny
Dev
Pics