Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

has-localstorage

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has-localstorage

returns true if localStorage is supported _and_ persistent

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.2K
increased by10.65%
Maintainers
1
Weekly downloads
 
Created
Source

has-localstorage

returns true if localStorage is supported and persistent

Build Status

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.

Downlaod or Installation

  • Download has-localstorage.js
  • or: install via Bower: bower install --save has-localstorage
  • or: install via npm: npm install --save has-localstorage

Usage

if (hasLocalStorage()) {
  // localStorage can be used, all data gets persisted
} else {
  // localStorage is not available, or changes are not persisted
}

Acknowledgement

hasLocalStorage() has been inspired by this Cappuccino commit: https://github.com/cappuccino/cappuccino/commit/063b05d9643c35b303568a28809e4eb3224f71ec

License

MIT

Keywords

FAQs

Package last updated on 02 Jan 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc