Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
has-localstorage
Advanced tools
returns true if localStorage is supported and persistent
returns true
or false
depending on whether localStorage is supported or not.
Beware that some browsers like Safari do not support localStorage in private mode.
bower install --save has-localstorage
npm install --save has-localstorage
if (hasLocalStorage()) {
// localStorage can be used, all data gets persisted
} else {
// localStorage is not available, or changes are not persisted
}
hasLocalStorage()
has been inspired by this Cappuccino commit:
https://github.com/cappuccino/cappuccino/commit/063b05d9643c35b303568a28809e4eb3224f71ec
MIT
FAQs
returns true if localStorage is supported _and_ persistent
The npm package has-localstorage receives a total of 3,184 weekly downloads. As such, has-localstorage popularity was classified as popular.
We found that has-localstorage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.