3

I'm creating a webapp which uses the localStorage.

I would like to show something like: X % is used over Y Megabytes

How to calculate that?

Regards.

Syl
  • 2,100
  • 7
  • 30
  • 43

2 Answers2

1

IE has a proprietary propery "window.localStorage.remainingSpace" which returns the remaining space in bytes. Unfortunately can't find similar functionality in any of the other browsers.

http://msdn.microsoft.com/en-us/library/cc197016(v=vs.85).aspx

Roy Paterson
  • 793
  • 7
  • 16
1

I think that this will help you out Calculating usage of localStorage space

There is no way to query to browser for that exact information

Community
  • 1
  • 1
JoshStrange
  • 1,043
  • 1
  • 7
  • 19
  • 1
    What they are doing in that answer is constantly writing to LocalStorage until it fills up, that way they know how much space there is – JoshStrange Dec 20 '11 at 14:35