问题描述
在浏览器(包括iPhone的Safari)上,localStorage通常有5MB的限制。
There is usually a limit of 5MB on localStorage on browsers, including iPhone's Safari.
由于PhoneGap具有更高的安全权限,包括访问其他存储机制设备,理论上它们应该能够消除5MB的限制。
Since PhoneGap has the access higher security privileges including access to other storage mechanisms on the device, in theory they should be able to eliminate the limit of 5MB.
例如,它应该能够通过将数据存储在文件,等等,同时保持API与localStorage的javascript对象兼容。
For example, it should be able to get around the usual restrictions by storing the data on a file, etc while keeping the API compatible with localStorage javascript object.
这样做吗?或者是PhoneGap限制在相同的5MB?
Is this done? Or is PhoneGap limited to the same 5MB?
推荐答案
PhoneGap不做任何事情以扩展默认限制。在Android上,我在localStorage中获得了2.5M个字符(JavaScript中的字符串是UTF-16)。
PhoneGap doesn't do anything out of the ordinary to extend the default limits. On Android, I get 2.5M characters in localStorage (Strings in JavaScript are UTF-16).
您可以在这里找到大多数浏览器的默认限制:
You can find default limits for most browsers here: http://dev-test.nemikor.com/web-storage/support-test/
这有助于理解限制,我使用代码创建了一个简化的PhoneGap应用程序。
This was helpful in understanding the limitations, and I used the code to create a simplified test PhoneGap app.
这篇关于PhoneGap上的LocalStorage限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!