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.
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! :(