5

I'm trying to build a web app that needs to work offline at times. The standard approach until now has been to use the browser's Application Cache. However, it appears that Application Cache is deprecated and will be removed from browsers in the future (see https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache). The recommendation is to use Service Workers. However, Service Workers is not currently fully supported in all browsers.

So, what to do? What is the best way, today, to go about building an offline web application, considering the current state of Application Cache and Service Workers? Are there other approaches that are less reliant on browser features?

  • Take a look at http://www.dexie.org/ – Coz Oct 16 '15 at 02:27
  • 1
    Consider using a polyfill https://github.com/coonsta/cache-polyfill – Aron Oct 16 '15 at 02:58
  • 1
    That polyfill implements a few methods in the Cache Storage API that aren't available in Google Chrome. It's not a polyfill for service workers in general, or for the Cache Storage API in general. – Jeff Posnick Oct 16 '15 at 14:46

1 Answers1

2

You could choose to use Service Workers and AppCache on the same web app. What happens in such a case is that browsers that don’t support Service Workers will use AppCache, and those that do will ignore the AppCache and let the Service Worker take over.

Source: https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API#compat-mobile

Chrome Issue: https://crbug.com/410665

Personally, I wouldn't bother with AppCache unless offline is a main part of the app.

Daniel Herr
  • 19,083
  • 6
  • 44
  • 61