Issues with Safari (iOS and Mac) when in Private Browsing mode #66

Closed
nhoizey opened this Issue Apr 18, 2013 · 5 comments

Projects

None yet

3 participants

@nhoizey
nhoizey commented Apr 18, 2013

It seems Private Browsing makes localStorage read only:
http://spin.atomicobject.com/2013/01/23/ios-private-browsing-localstorage/

When loading store.js, I get this error:
QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota.

I saw these lines in the lib:

try {
  store.set(namespace, namespace)
  if (store.get(namespace) != namespace) { store.disabled = true }
  store.remove(namespace)
} catch(e) {
  store.disabled = true
}

Maybe there's something to improve there…

Owner

Hi @nhoizey - sorry for the delayed response! Do you check e.g. if (store.disabled) { alert("Can't use store") } before using store? Basically, if store.disabled == true then you can't use it.

nhoizey commented Apr 24, 2013

Thanks @marcuswestin for the answer.

I didn't notice store.disabledexists, I will try to use it!

Owner

That's great! If you've got the time to add some text to the readme so that others won't have the same problem I'd definitely merge that in!

Have a good Wednesday :)
-- while mobile

On Wed, Apr 24, 2013 at 6:09 AM, Nicolas Hoizey notifications@github.com
wrote:

Thanks @marcuswestin for the answer.

I didn't notice store.disabledexists, I will try to use it!

Reply to this email directly or view it on GitHub:
#66 (comment)

@npmcomponent npmcomponent pushed a commit to npmcomponent/nbubna-store that referenced this issue Jan 6, 2014
@nbubna nbubna rewrite overflow extension to be a solution for marcuswestin/store.js#66
1c5ed91

@marcuswestin I see on the README and in this issue that basically you are recommending devs to ask users to switch off Private Browsing mode, otherwise store.js will not function.

May I recommend my project, memorystorage as an alternative to giving up? It's basically a polyfill for localStorage that's backed by regular memory. Sure, the data won't survive a browser reload, but there were never any guarantees anyway and at least the app will mostly work.

I'm currently using Rhaboo in my project and it too failed in Private Browsing mode, so I hacked on it to get it fixed and ended up developing MemoryStorage as a fallback and it's been working great for me.

Owner

Store.js v2.0 has been released with support for Safari private mode.

If you update to the latest version using the v1 backcompatible build you will automatically get this functionality plus a bunch more :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment