1

I am new to PWA. I am supposed to build a PWA, which should work in both offline mode and online mode. I am storing my data in indexedDB to work with it in offline mode. When I am closing the browser the indexedDB gets deleted, is there a way to prevent it? Also on closing the browser all the cached files are deleted as well, is there a way to prevent that. I dont want to use localStorage as I need to store blobs in offline mode.

Thanks

isherwood
  • 58,414
  • 16
  • 114
  • 157
  • You can't prevent the user from deleting their data, from their web browser (because it is their web browser). There are no local databases to which that rule does not apply. If you want to protect against accidental deletion of data: Sync it to a user account on your server. – 92yo Sep 28 '21 at 21:13
  • What you are looking for is called "persistent storage" – Gordon Sep 28 '21 at 21:43
  • 1
    Look at this question and see if it helps you any: https://stackoverflow.com/a/55403450/3935060 – Gordon Sep 28 '21 at 21:45
  • Thank you all, yes I didnt know about persistent storage. This is really helpful – Mruga Majmudar Oct 08 '21 at 03:48

0 Answers0