JavaScript memory and HTML5 LocalStorage limitations on smartphones

后端 未结 3 1824
轻奢々
轻奢々 2020-12-08 05:37

I\'m going to develop web application which should work on mobile devices (smartphones). In the application the operator will input some business data, and

相关标签:
3条回答
  • 2020-12-08 05:41

    In my experience you can reliably bet on 5MB minimum for the platforms you mention above. Keep your data below that level and you should be pretty safe.

    Read this article. http://diveintohtml5.info/storage.html it has some nice nuggets of info, but it's not all accurate, especially the part that says you cant up the limit.
    I know for a fact that on iPhone once you reach the limit the phone will ask the user if they want to allow more space. (Sort of accurate, but not entirely)

    On Android platforms the heap memory limit is set at 12MB. Not sure about the other platforms. Since you are going to be running in some kind of webcontainer (Webkit or other) I wouldn't worry too much about it. The containers themselves are pretty good at managing memory and implementing file caches to minimize their footprint.

    I recommend you leave the memory optimizations and such for last. Who knows, you might not even need it. Dont optimize prematurely.

    PS:
    Look at Phonegap: http://phonegap.com/

    0 讨论(0)
  • 2020-12-08 05:57

    On my lowly HTC Wildfire S using Android 2.3.5 your page stopped at 2,600,000. I'm impressed it got that high.

    On Firefox 16.0.1 desktop it stopped at 5,200,000 which is consistent with what about:config quota is defined at.

    0 讨论(0)
  • 2020-12-08 06:02

    just tested out your link: check localstorage

    • Chrome 16.0.912
    • iPad2 IOS 5.0.1
    • iPhone 3GS

    all go until 2.600.000 characters. Since UTF-8 has 4 bytes just multiply it by four and you get the total bytes.

    10400000 bytes = 9,918 MegaBytes

    0 讨论(0)
提交回复
热议问题