最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - LocalStorage limit on PhoneGap - Stack Overflow

programmeradmin3浏览0评论

There is usually a limit of 5MB on localStorage on browsers, including iPhone's Safari.

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.

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.

Is this done? Or is PhoneGap limited to the same 5MB?

There is usually a limit of 5MB on localStorage on browsers, including iPhone's Safari.

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.

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.

Is this done? Or is PhoneGap limited to the same 5MB?

Share Improve this question edited Dec 9, 2011 at 14:07 Mo Valipour 13.5k13 gold badges63 silver badges87 bronze badges asked Dec 9, 2011 at 11:05 PaymonPaymon 1,1931 gold badge9 silver badges26 bronze badges
Add a comment  | 

4 Answers 4

Reset to default 7

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/

This was helpful in understanding the limitations, and I used the code to create a simplified test PhoneGap app.

PhoneGap has File API that should not be affected by browser local storage limits but don't know if there exist any abstraction to make it behave as HTML5 local storage "backend".

If you want to store a large amount of data you should not do that in localStorage, there are databases and files for that kind of need. localStorage is a key-value datastore, it's use is limited and it should not be "hacked" to fit all needs.

Localstorage is something which is provided by the browser.

Localstorage is not something which is available on a device, either a mobile phone or a desktop, that is leveraged by a browser.

Since it is something which the browser provides there is no way, we can change/increase it using Phonegap since your Phonegap app runs inside the browser.

If you want more storage space, you can use a technique which Phonegap can access like a file storage or SQlLite.

发布评论

评论列表(0)

  1. 暂无评论