0

The code in question is below, on the iPad (2 if that matters to anyone), I get the error DOM Exception 22, which from my research is exceeding the quote of space when adding values.

Here's where it gets interesting. In standard browsing mode on Safari, I get the error. However, when I switched to private mode NOTHING! The code is good, it works on every other device I've tested and all browsers. I thought by default storage was off in private mode but for some reason that's the only way the code is valid for me. Any tips?

   .success(function (data){
     .console.log(data);
     sessionStorage.setItem('token', data.access_token);
     sessionStorage.setItem('userName', data.userName);
Brad Martin
  • 5,637
  • 4
  • 28
  • 44
  • 1
    It's the private mode that causes restrictions. Same thing happens e.g with localStorage. You could encapsulate your code with try - catch, see: http://stackoverflow.com/questions/14555347/html5-localstorage-error-with-safari-quota-exceeded-err-dom-exception-22-an – Samuli Hakoniemi May 19 '14 at 20:54
  • You're right. Stupid me, someone had opened Safari and went Private (I don't use it very often) so I had no idea it was on. I went to turn it on, and clicked Private and thought the change in color of the toolbar meant it went private but DARK background is Private and light is Standard. Had no idea! Feeling really smart right about now.... :/ – Brad Martin May 19 '14 at 21:19
  • And if you're for some reason forced to have sessionStorage support for private mode also, google with "window.name session". It's an old-school solution, but still feasible. – Samuli Hakoniemi May 19 '14 at 21:20
  • Thanks for the advice everyone. Good to go now. – Brad Martin May 19 '14 at 21:21

1 Answers1

0

The iPad was in Private mode already, someone had turned it on and I assumed no one had used it and didn't pay attention to the color change when switching, to what I assumed was Private mode, but indeed I was going to Standard. Thanks!

Brad Martin
  • 5,637
  • 4
  • 28
  • 44