如何增加Android WebView中LocalStorage的配额限制

时间:2022-02-11 16:48:10

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.

我需要增加Android WebView中本地存储的默认配额限制。目前我只能使用2.5MB左右。当尝试存储更多数据时,会引发quota_exceed_err (dom异常22)。

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

有什么想法或者我必须切换到db/文件系统吗?

2 个解决方案

#1


7  

We're talking about HTML5 WebStorageDOCS

我们说的是HTML5 WebStorageDOCS

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

关于同一个主题有很多问题,只是不是针对android的

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)

事实是,HTML5 WebStorage在不同平台上的实现不同。桌面和移动平台&浏览器的组合在分配给每个网站(域)的内存(磁盘空间)配额大小上是不同的

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.

不,你不能增加/减少为HTML5应用程序分配的空间,在WebSettings如Android WebKit Settings Java accessor类中没有这样的选项,在WebKit实现HTML5 WebStorage时也没有。

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

参见:http://dev.w3.org/html5/webstorage/磁碟空间

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.

建议对每个来源设置一个几乎任意的5兆字节的限制。执行反馈是受欢迎的,并将在将来用于更新这个建议。

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

如果您的HTML5应用程序真的需要很大的空间(无论它是通过PhonGap、Titanium、Rhodes还是其他…),我强烈建议您使用HTML Web SQL数据库

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.

该文档位于W3C推荐的轨道上,但是规范工作已经停止。规范陷入了僵局:所有感兴趣的实实者都使用了相同的SQL后端(Sqlite),但是我们需要多个独立的实现来沿着标准化的路径前进。

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.

Web SQL现在只支持Android设备上的方式(您在这个问题中确实有这个目标),它允许您增加/减少数据的空间分配。

Please note the related question:

请注意相关问题:

#2


0  

I just wrote a minimal script for that: https://github.com/DVLP/localStorageDB

我只是为此编写了一个小脚本:https://github.com/DVLP/localStorageDB

The goal is to have a very simple usage with key - value pairs like in localStorage, and take advantage of large size of IndexedDB and it's potential performance gain thanks to it being asynchronous.

我们的目标是对key - value对有一个非常简单的用法,就像在localStorage中一样,并且利用IndexedDB的大容量,并且由于它是异步的,所以它有潜在的性能提升。

Hope you'll find this useful!

希望你会觉得这个有用!

#1


7  

We're talking about HTML5 WebStorageDOCS

我们说的是HTML5 WebStorageDOCS

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

关于同一个主题有很多问题,只是不是针对android的

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)

事实是,HTML5 WebStorage在不同平台上的实现不同。桌面和移动平台&浏览器的组合在分配给每个网站(域)的内存(磁盘空间)配额大小上是不同的

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.

不,你不能增加/减少为HTML5应用程序分配的空间,在WebSettings如Android WebKit Settings Java accessor类中没有这样的选项,在WebKit实现HTML5 WebStorage时也没有。

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

参见:http://dev.w3.org/html5/webstorage/磁碟空间

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.

建议对每个来源设置一个几乎任意的5兆字节的限制。执行反馈是受欢迎的,并将在将来用于更新这个建议。

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

如果您的HTML5应用程序真的需要很大的空间(无论它是通过PhonGap、Titanium、Rhodes还是其他…),我强烈建议您使用HTML Web SQL数据库

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.

该文档位于W3C推荐的轨道上,但是规范工作已经停止。规范陷入了僵局:所有感兴趣的实实者都使用了相同的SQL后端(Sqlite),但是我们需要多个独立的实现来沿着标准化的路径前进。

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.

Web SQL现在只支持Android设备上的方式(您在这个问题中确实有这个目标),它允许您增加/减少数据的空间分配。

Please note the related question:

请注意相关问题:

#2


0  

I just wrote a minimal script for that: https://github.com/DVLP/localStorageDB

我只是为此编写了一个小脚本:https://github.com/DVLP/localStorageDB

The goal is to have a very simple usage with key - value pairs like in localStorage, and take advantage of large size of IndexedDB and it's potential performance gain thanks to it being asynchronous.

我们的目标是对key - value对有一个非常简单的用法,就像在localStorage中一样,并且利用IndexedDB的大容量,并且由于它是异步的,所以它有潜在的性能提升。

Hope you'll find this useful!

希望你会觉得这个有用!