0

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.

Zara_tj
  • 95
  • 1
  • 3
  • 8
  • Possable duplicate. You can use javascript to check if user is online. See here: http://stackoverflow.com/questions/2384167/check-if-internet-connection-exists-with-javascript – Gunnar Aug 10 '12 at 12:58

1 Answers1

1

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.

Fenton
  • 241,084
  • 71
  • 387
  • 401
  • Ok so it kind of work just one little glitch when I add new image to page and add it to the mainifest file it doesnt seem to load just display box with question mark in it – Zara_tj Aug 10 '12 at 14:37