localStorage does not work in Safari in Private Browsing mode

July 12, 2015

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.