Reputation: 95
I have built a html5 gallery which does work offine but what I need help with is getting the app to detect if the user is online and if so will update the mainifest when the user opens up the app.
Upvotes: 0
Views: 144
Reputation: 251222
Firstly, you need to make sure that the manifest file isn't listed in the manifest file as this will prevent it from being re-fetched even if the user is online.
Once you have done this, if you set cache-mode
to prefer-online
it will re-fetch the pages when a connection is available. If you only want to update the manifiest, you don't need to do this step, most user agents will re-fetch the manifest when a connection is available as long as it is not included in its own listing.
You can also force it using the JavaScript API:
window.applicationCache.update()
You can see this example and lots more details of the JavaScript API here.
Upvotes: 1