7

I'm seeing a few comments from people suggesting that localStorage on an iPad is unreliable. Can anyone confirm that they are happily using localStorage on an iPad? I understand that there is a 5Mb limit too - is that still the case?

Thanks

Journeyman
  • 10,011
  • 16
  • 81
  • 129

1 Answers1

14

I've been working on a project that uses localStorage on an iPad. In my experience, the localStorage is perfectly stable. However, there are two things to consider:

  • Yes, the storage-limit is still 5Mb. Since characters are stored UTF16, only 2.5M characters can be stored in localStorage.

  • In contrast to other localStorage implementations, localStorage.setItem() doesn't delete any previous items with the same key before storing the new item. In other words: When overwriting an item, one should always call localStorage.removeItem() before calling localStorage.setItem(), or you'll quickly run out of space.

TinkerTank
  • 5,685
  • 2
  • 32
  • 41