snapjay / ngCart

Really simple shopping cart for AngularJS
http://ngcart.snapjay.com
380 stars 236 forks source link

Safari Private Browsing Mode - Can't store data #52

Open atomworks opened 8 years ago

atomworks commented 8 years ago

I've been working on an issue for an edge case that could still be relevant to a lot of people. Both Safari on OSX and iOS when in private browsing mode shuts off the ability to use both sessionStorage and localStorage.

So, for example, a customer is browsing your store on their phone on iOS. Because they were looking at something they didn't want tracked previously they were in private mode and opened a new tab, which will do so in private. As they shop they can add items to the cart but as soon as the page reloads all this data is lost.

For some strange reason Apple decided to close off this functionality and rather than just clear that data once you close the tab, they just set the quota available to 0.

Good news is I've created a working fallback for these rare instances and I'm happy to do a pull request once I've tested it properly (and if you're interested of course).

I'll do an initial pull request that makes some minor changes in preparation for this. It just changes some localStorage implementations so they can be replaced later.