What is the storage limit for staff?

Most browsers provide a localStorage storage limit of 5 MB per domain. Are there memory limitations / restrictions for service workers?

I know that web workers (on whom work services work) do not have such restrictions. But web workers are definitely not used for caching resources; instead, they are used more for processing (therefore, the main problem here is the CPU).

If there is no memory size limit, can a poorly designed website crashes the browser?

+42
javascript progressive-web-apps service-worker
Feb 06 '16 at 15:39
source share
5 answers

I recently came across this article: offline-cookbook , which reads:

Your source is given a certain amount of free space to do what he wants. This free space is shared between all storage storages : LocalStorage, IndexedDB, File System and, of course, Cache.

the amount is not indicated , it will differ depending on the conditions of the device and storage conditions. You can find out how much you have:

navigator.storageQuota.queryInfo("temporary").then(function(info) { console.log(info.quota); // Result: <quota in bytes> console.log(info.usage); // Result: <used data in bytes> }); 

The above code may not work in all browsers . (e.g., in chrome <48, you might have to look for webkitPersistentStorage, etc.)

Other useful information / resources

  • According to Addie Osmani Offline Storage for Progressive Web Applications

    In Chrome and Opera : your storage is at the beginning (not the API). Both storage engines will store data until a browser quota is reached. Applications can check how many quotas they use with the quota management API (as described above).

    Firefox no limits, but will be queried after storing data at 50 MB

    Mobile Safari 50 MB maximum

    Desktop Safari unlimited (tooltips after 5 MB)

    IE10+ maxes at 250 MB and prompt at 10 MB

  • A more detailed guide to working with quotas in mobile browsers from Eiji Kitamura.

At the moment, these are the most relevant articles / solutions found for my problem. If anyone knows any better article or spec, please share.

+50
Feb 29 '16 at 9:54 on
source share

There is no clear limit. All modern browsers are multiprocessor or similar, so a poorly designed page (or SW) will not do anything worse than the accident itself.

Please note that the SW specification is very clear that the browser can kill and restart the software at any time for any reason. (If DevTools is open on the page, Chrome intentionally kills the SW for the page constantly to encourage you to adopt good practices.)

+9
Feb 06 '16 at 17:09
source share

I am not 100% sure, but I think that you are completely limited by what is available on the client machine. As with no fixed upper limit

If someone ran the beast of the machine, and the browser was the only active application, then most likely you will have enough available storage.

However, if it was an old limited machine that was barely breathing; you will have very little

It totally depends on what you are trying to actually do. You really need to use service workers to store things important for your page / application.

+1
Feb 06 '16 at 15:49
source share

In the latests browser you can use StorageManager , which is an implementation of the new standard for browser storage, see this mozilla article .

 let _storageStats = await navigator.storage.estimate(); console.log(_storageStats); /* Will prompt something like this {quota: 15946471833, usage: 682} Which is a representation of quota/usage in bytes As you can see I get an insane quota of almost 16 GB */ 
+1
Oct 25 '17 at 12:52 on
source share

Read more about navigator.storage.estimate() and navigator.webkitTemporaryStorage.queryUsageAndQuota() here https://developers.google.com/web/updates/2017/08/estimating-available-storage-space

Testing page here https://thimbleprojects.org/startpolymer/361372/

+1
Nov 21 '17 at 16:47
source share



All Articles