I use the application cache to make my webapp work without internet access. When a new version of the app is ready, the manifest file is changed to trigger a re-download of the app.
The app uses a lot of json data, and what I've done is have the app download the json data though an ajax call at boot, and put it in the localStorage before using it. If the user is offline, the app fetches the data from localStorage instead of the network.
However, quite a lot of things in the app are using localStorage, so to avoid hitting the storage quota ceiling I want to try to move that json data out of there. My idea was to make the data available offline though the application cache, just like the app code.
The behavior I want is that whenever the user has internet access they fetch the json data freshly from the server, while whenever the user is offline they get served the last cached version of the json data.
I was thinking I could do this by simply putting the json data's url under the NETWORK: section, and then put a FALLBACK: clause for the same url that redirects to a cached version, so that if the url is unreachable the user gets served by the fallback instead.
However, this way is flawed because as the user regains his internet access and fetches fresh data from the server, the data cached in the FALLBACK: url will not be updated to match the newest. That is, unless I change the manifest file and force the entire webapp to be re-downloaded, which I don't want to do. My json data changes frequently, so I want to avoid this problem.
From my googling there is no way to programmatically invalidate a single file in the application cache. Is there any way to work around this issue?
Or is there no way to just make the application cache behave on the principle of "always use the online version if available"?