5 ms·
This is offline cache, you can run your application even without internet connection.
by Softcadbury 9y ago
This is offline cache, you can run your application even without internet connection.
- Kiro 9y agoWhat are some examples where offline works for a web app? It seems like the utility is really niched so I don't understand why they make this default. None of the things I've made would make sense using offline (completely anecdotal but still).
- danabramov 9y agoIt‘s not just about offline, but about serving assets instantly on repeated visits (while they update in background). You don’t need to wait for request at all.
- coldtea 9y ago>What are some examples where offline works for a web app? Tons of web apps that work in offline mode, which we had since a decade or so -- from games to utility apps. >It seems like the utility is really niche Hardly.
- GeneralMaximus 9y agoIt's also nice to be able to selectively cache some data offline so that users aren't greeted with a "you are offline" screen when they hit your web page without a network connection. For an e-commerce website, this might be the user's shopping cart and favorites. For a note taking app, this might be the last note the user edited. For a Twitter client, this might be the user's drafts and the last 100 tweets on their timeline. This way, the app can say "you're offline, but you can still look at some of this data and do things with it, and we'll sync you up when you get back online". Native apps already do this. E.g, try posting a picture to Instagram while you're offline.
- Vinnl 9y agoAn example is a webmail client, where in offline mode you can schedule new emails to be sent as soon as you get online again, and where you can still read the emails you've read before.
- capisce 9y agoIsn't it the case that the offline resources are considered "caches" and thus might be cleaned up if there's not much storage left?
- Vinnl 9y agoYes, as far as I know, storage space is still limited, so you wouldn't want to be storing GBs of offline emails. I'm not sure how enforcing works nowadays - it used to be that old offline data would be culled (I think that was for AppCache), but that might work differently with Service Workers.
- konradkpl 9y agoThere are a lot of strategies for supporting offline state in your app: https://jakearchibald.com/2014/offline-cookbook/ https://jakearchibald.com/2014/offline-cookbook/ In dashboard application, I store data in browser and notify users about last sync time: http://wstaw.org/m/2017/05/19/dashboard.livechatinc.com-iPhone_6_Plus_1.png http://wstaw.org/m/2017/05/19/dashboard.livechatinc.com-iPho...
- mbrock 9y agoI don't know about making it the default, because there are tradeoffs with regard to the cache invalidation. That said, offline-friendly app caching with Service Workers is extremely useful, and changed the way I see and make web apps. Now when I use a web app that isn't offline-friendly, I get annoyed. Always demanding a live internet connection obviously creates latency and unreliability for apps. I changed a former client's app to be offline-friendly with Service Workers, and the benefit was obvious: their app now loaded immediately for repeat users, and they could access much of their data even when they were offline (on a flight, on a crappy Wi-Fi, etc etc). I made a side-project to help my band members share and edit chord/lyrics sheets (also using Web Audio to give karaoke-style chord playback!) and again I made sure to set up full Service Worker caching. I also used PouchDB for the user data, which was beautiful: I didn't need to run any database server (we just used Cloudant's free instances), all our songs were synced into local browser storage (in real-time when online), and most importantly, the whole app worked perfectly while in the basement rehearsal space that completely blocks mobile signals. (I'm not working on it nowadays. It's up on https://sketch.band https://sketch.band and the code is at https://github.com/mbrock/sketchband https://github.com/mbrock/sketchband under AGPL3. If you wanna try it, the undocumented syntax for the song is: each line should look like "C Dm7 / Once upon a time you dressed so fine".) Basically offline-first technologies really help make the web into a good platform for apps.