Search code examples
htmlcordovalocal-storagehtml5-appcache

AppCache for 24 hours?


Recently I started using the

<html manifest="cache.appcache">

method for storing assets in my PhoneGap application.

Is it possible to use appcache but have it check every 24 hours for an updated version of the cached items?


Solution

  • To do so you have to generate the cache.appcache dynamically and add a comment line which changes in the desired interval:

        CACHE MANIFEST
        # 2012-07-31 14:30
    
        css/default.css
        ...
    

    and after 24 hours:

        CACHE MANIFEST
        # 2012-08-01 14:30
    
        css/default.css
        ...
    

    If changes in the content of that file happens a browser loads all cached data again.

    NOTE: just a touch in file system does not bring the expected result. The content itself has to change.

    http://appcachefacts.info/