3 ms·
I'm astonished at the lack of feature detection. I though that was common knowledge. Using feature detection solves the SSR issue and as a bonus that code won'
by ficklepickle 7y ago
I'm astonished at the lack of feature detection. I though that was common knowledge.
Using feature detection solves the SSR issue and as a bonus that code won't error if localStorage doesn't otherwise exist (old browsers, tests).
The best method of feat. detection of localStorage, IMO, is writing and reading back a test value in a try catch block. That will catch safari incognito which lies about support.