Cjxcz Odjcayrwl
Cjxcz Odjcayrwl

Reputation: 22867

Unlimited size of local storage under IE 9?

I have just re-written test for HTML5 persistent storage (localStorage) capacity (the previous one created 1 key in memory, so it was falling on memory exception). I've created also jsFiddle for it: http://jsfiddle.net/rxTkZ/4/

The testing code is a loop:

   var value = new Array(10001).join("a")
   var i = 1
   var task = function() {
       localStorage['key_'+i] = value
       $("#stored").text(i*10)
       i++
       setTimeout(task)
   }
   task()

The local storage capacity under IE9, as opposite to other browsers, seems to be practically unlimited - I've managed to store over 400 million characters, and the test was still running.

Is it a feature I can rely on? I'm writing application for intranet usage, where the browser that will be used is IE 9.

Upvotes: 1

Views: 221

Answers (1)

user1693593
user1693593

Reputation:

Simple answer to this: no :)

Don't paint yourself into a corner. Web Storage is not meant to store wast amount of data. The standard only recommends 5 mb, some browser implement this, others less (and considering that each char takes up 2 bytes you only get half of that perceptually).

Opera let users adjust the size (12 branch, dunno about the new webkit based version) but that is a fully a user initiated action.

It's not a reliable storage when it comes to storage space. As to IE9 it must be considered a temporary flaw.

If you need large space consider File API (where you can request user approved quota for tons of megabytes) or Indexed DB instead.

Upvotes: 1

Related Questions