Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(How) can I increase the quota limit of LocalStorage in Android WebView

I need to increase the default quota limit of the LocalStorage in a Android WebView. Currently I can only use around 2.5MB. When trying to store more data, a quota_exceeded_err (dom exception 22) is raised.

Any ideas or do I have to switch to db/file system ?

like image 450
NATOR Avatar asked Mar 27 '12 18:03

NATOR


People also ask

Does LocalStorage have a size limit?

It is limited to about 5MB and can contain only strings. LocalStorage is not accessible from web workers or service workers. Cookies have their uses, but should not be used for storage.

Does LocalStorage work in WebView?

The test. html file informs me that local storage is'nt supported by my browser (ie. the webview ).

How much data can you store in LocalStorage?

Maximum limit of data saving is about 5 MB in LocalStorage also. LocalStorage has no expiration time, Data in the LocalStorage persist till the user manually delete it. This is the only difference between LocalStorage and SessionStorage.

How big is Chrome local storage?

Apps that were designed to run in Google Chrome. Note: Web storage APIs like LocalStorage and SessionStorage remain fixed at 5 MB. Note: Web storage APIs like LocalStorage and SessionStorage remain fixed at 5 MB.


1 Answers

We're talking about HTML5 WebStorageDOCS

There is plenty of question on the same theme, only not Android-specific

  • HTML5 localStorage size limit for subdomains
  • What is the max size of localStorage values?
  • HTML5 LocalStorage size

Fact is, that HTML5 WebStorage suffers from different implementation on different platforms.
Desktop and Mobile Platforms & Browsers combinations differs in size of memory (disk space) quota assigned to each website (domain)

And no, you cannot increase/decrease space allocated for your HTML5 application, there is no such option in WebSettings as Android WebKit Settings Java accessor class, neither in WebKit implementation of HTML5 WebStorage as of now.

citation: http://dev.w3.org/html5/webstorage/#disk-space

A mostly arbitrary limit of five megabytes per origin is recommended. Implementation feedback is welcome and will be used to update this suggestion in the future.

If you really need a large space in your HTML5 Application (no matter if it runs through PhonGap, Titanium, Rhodes or another...), I would strictly recommend you to use HTML Web SQL Database

Even if the DOCS say:

This document was on the W3C Recommendation track but specification work has stopped. The specification reached an impasse: all interested implementors have used the same SQL backend (Sqlite), but we need multiple independent implementations to proceed along a standardisation path.

The Web SQL is now only supported way on Android devices (which you do aim in this question) which allows you to increase/decrease space allocation for your data.

Please note the related question:

  • HTML5 IndexedDB, Web SQL Database and browser wars
like image 120
Marek Sebera Avatar answered Sep 25 '22 13:09

Marek Sebera