Last active
July 21, 2016 15:33
-
-
Save electerious/7c6cddb019bc96445eccb1a8653aa6a9 to your computer and use it in GitHub Desktop.
Detect if browser supports localStorage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hasLocalStorage = () => { | |
const tmp = 'tmp' | |
try { | |
localStorage.setItem(tmp, tmp) | |
localStorage.removeItem(tmp) | |
return true | |
} catch (e) { | |
return false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment