Skip to content

Instantly share code, notes, and snippets.

@electerious
Last active July 21, 2016 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save electerious/7c6cddb019bc96445eccb1a8653aa6a9 to your computer and use it in GitHub Desktop.
Save electerious/7c6cddb019bc96445eccb1a8653aa6a9 to your computer and use it in GitHub Desktop.
Detect if browser supports localStorage
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