Search code examples
androidcordovachromiumcordova-3html5-appcache

Phonegap appcache with a 60 seconds timeout


I'm using Phonegap with appcache on KitKat. The problem is: I open the app, it stores the cache and everything goes right. If I close the app, shutdown the server and reopen the app, the appcache tries to retrieve the manifest. Only after 60 seconds it times out and it allows to render the previously cached files. So, what I have to do?

This is my appcache manifest:

CACHE MANIFEST
# test
CACHE:
index.html
/application.css
javascripts/application.js
/application.js

NETWORK:
*

Solution

  • The problem is

    NETWORK:
    *
    

    If you leave the NETWORK section out and open a path that is already cached, the browser will use the cached version immediately even when online, without waiting for the timeout.

    If you still need to load paths that are not explicitly listed in your appcache manifest, list them in the NETWORK section. Prefixes work, so if you all your ajax calls go to /backend/... just add "/backend" (without * at the end) to the NETWORK section.