localStorage and sessionStorage in Safari's private mode
If you didn't know, in Safari's private mode both
sessionStorage are not working. To be exact, Safari sets storage's limit to 0, so you can't write anything to it. I keep forgetting this, until QA people report it at some point.
So I quickly wrote a small facade for it, which fails silently in this case. That means it still doesn't work but it won't throw an error and break your application.
This is the version for
localStorage, just replace it with
sessionStorage if you need it.
// Try to
try catch e