(How) can I increase the quota limit of LocalStorage in Android WebView
We're talking about HTML5 WebStorage
DOCS
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:
NATOR
Updated on July 20, 2022Comments
-
NATOR almost 2 years
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 ?
-
NATOR about 12 yearsthx, I already knew most of this, but was hoping for a miracle ;) so now I will have to switch my application to Web SQL DB ... so be it!
-
Marek Sebera about 12 years@NATOR sorry for not bringing out the miracle ;-)
-
Michael almost 11 yearsIs there no way for the user to increase this limit?
-
oligofren almost 11 years@MarekSebera How do you actually "increase/decrease space allocation for your data."? This is my exact problem ATM in a hybrid web app. WebSettings seems to be the answer, but I am not sure how...
-
Marek Sebera almost 11 years@oligofren read again, the answer is not WebSettings, but using WebSQL to store data instead of localStorage.
-
oligofren almost 11 years@MarekSebera I read that. And I meant WebSQL. In a normal Android web app the limit on WebSQL databases is approximately 8MB. Does this differ in a WebView?
-
venkatvb over 7 years"you cannot increase/decrease space allocated for your HTML5 application" is this the same case till now?
-
Marek Sebera over 7 years@venkatvb seems so, only thing relevant is, that instead of fixed storage quota, Android WebKit uses HTML5/JS automatic quota management, which should result in less problems with limited storage space. But WebSettings has methods. You can query current quota by
https://developer.android.com/reference/android/webkit/WebStorage.html#getQuotaForOrigin(java.lang.String, android.webkit.ValueCallback<java.lang.Long>)
but methods, that previously allowed to set quota, are deprecated since API 18, so you cannot set/decrease/increase quota in any way right now.