4

How much data can we keep in the browser, so that we can have access to the files again after closing / reopening the browser?

LocalStorage seems to allow ~ 5 or 10 MB (depending on the browser).

Other systems might be available (such as IndexedDB), as detailed here, but it seems quite complex.

Question: is there a simple-to-use technique (working at least for Chrome+Firefox, or even better if totally cross-browser, and both mobile and desktop) allowing to store more than 100MB (up to 500MB)?

Use-case: a website allowing to play piano with high quality samples (let's say 150 MB audio samples), and prevent to have to re-download the data each time we open the page.

PS: I'm preferably looking for a solution not requiring to install an extension or a browser plugin.

Basj
  • 41,386
  • 99
  • 383
  • 673
  • Looks like a job for regular [browser caching](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching). – Ivar Jun 17 '18 at 10:11
  • I'm not too familiar with it but you can have a look at [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Basic_Concepts_Behind_IndexedDB). – Ivar Jun 17 '18 at 10:12

1 Answers1

2

Yes!

As mentioned in the comments as well IndexedDB is the way to go. PouchDB has a nice FAQ about the storage limits between different browsers.

Though Firefox has no upper limit besides disk space, if your application wishes to store more than 50MB locally [In IndexedDB], Firefox will ask the user using a non-modal dialog to confirm that this is okay.

Android works the same as Chrome as of 4.4+ (IndexedDB), while older versions can store up to 200MB (WebSQL).

And from the Chrome webpage.

Temporary storage is shared among all web apps running in the browser.{#It is also shared across all offline APIs, such as App Cache, IndexedDB, and File System. However, it does not include web storage APIs like Local Storage and Session Storage, which still has a limit of 5 MB per origin.#} The shared pool can be up to 1/3 of the of available disk space. Storage already used by apps is included in the calculation of the shared pool; that is to say, the calculation is based on (available storage space + storage being used by apps) * .333 . Each app can have up to 20% of the shared pool. As an example, if the total available disk space is 60 GB, the shared pool is 20 GB, and the app can have up to 4 GB. This is calculated from 20% (up to 4 GB) of 1/3 (up to 20 GB) of the available disk space (60 GB).

Community
  • 1
  • 1
Joe Thomas
  • 5,807
  • 6
  • 25
  • 36
  • Thank you for your answer joe-tom! PS: have you solved your problem about complexity of k choose n? Feel free to ping me in chat if you want to discuss further. (Maybe there was a misunderstanding, I'd be happy to help if needed) – Basj Jun 17 '18 at 20:04
  • @Basj, No worries I think I've gotten to the bottom of it, currently reading into parameterized complexity. I think my problem falls into one of those complexity classes. Thank you again for your input to the problem and for the offer :D ! – Joe Thomas Jun 17 '18 at 22:52