How much data can a browser save in localStorage

后端 未结 2 1615
慢半拍i
慢半拍i 2021-02-02 09:08

I\'m using web sql and indexeddb but as a fallback I want to use a btree/localstorage. How much data can I save in localStorage on a given browser/platform?

If no one kn

2条回答
  •  悲&欢浪女
    2021-02-02 09:56

    Thanks for the answer allaire. To get an exact answer I ended up writing a script. The ballpark results are that you get a minimum of 5MB on desktop webkit, ff, ie, opera. IE actually let me write 1GB, yes 1 GB of data.

    Oddly, ff crashed when trying to write a string with a length of 742 characters but it would write a string of length 1133 characters and this was with the cache cleared so I don't know what's up with that.

    ~1000 character object written to different localStorage[locations]

    How big of a string can a given localStorage location be?

    This is a messy script but you can run the tests yourself if you want:

    
    
    
    
    
    
    
    

提交回复
热议问题