Deviating from other major browsers, Safari does not allow accessing localStorage or sessionStorage when in Private Browsing mode.
It also just throws an QuotaExceededError, so you never can be sure whether you actually hit the quota limit or using localStorage is just not possible at all.

The only way to store data client side in Safari is to make use of cookies, which are pretty limited in their size (roughly 4kb) and will be sent to the server with every request.


I’ve put together a small example here. Opening it in Private Browsing mode in any major but Safari should display  LocalStorage: Yep! :).

Navigating to it in Safari (Private Browsing) will result in: LocalStorage: Nope! :(