{"_id":"has-localstorage","_rev":"4424141","name":"has-localstorage","description":"returns true if localStorage is supported _and_ persistent","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"gr2m","email":"gregor@martynus.net"}],"time":{"modified":"2026-04-08T13:49:16.000Z","created":"2015-01-02T14:57:27.798Z","1.0.1":"2015-01-03T11:04:19.455Z","1.0.0":"2015-01-02T14:57:27.798Z"},"users":{},"author":{"name":"Gregor Martynus"},"repository":{"type":"git","url":"git://github.com/gr2m/has-localstorage"},"versions":{"1.0.1":{"name":"has-localstorage","version":"1.0.1","description":"returns true if localStorage is supported _and_ persistent","main":"lib/has-localstorage.js","directories":{"test":"tests"},"scripts":{"jshint":"jshint -c .jshintrc lib/has-localstorage.js bin/ tests/","test":"npm run jshint && npm run test-browser","test-node":"sh bin/test-node.sh","test-browser":"node ./bin/test-browser.js","dev-server":"http-server -a 127.0.0.1 -p 8000","docs":"doxx --source lib/ --target docs/ --template docs/template.jade","deploy":"gh-pages-deploy "},"repository":{"type":"git","url":"git://github.com/gr2m/has-localstorage"},"keywords":["localstorage","browser","data"],"author":{"name":"Gregor Martynus"},"license":"MIT","bugs":{"url":"https://github.com/gr2m/has-localstorage/issues"},"homepage":"http://gr2m.github.com/has-localstorage","devDependencies":{"chai":"^1.10.0","doxx":"^1.2.1","expect.js":"^0.3.1","gh-pages-deploy":"^0.1.1","http-server":"^0.7.4","jshint":"^2.5.11","mocha":"^2.1.0","request":"^2.51.0","sauce-connect-launcher":"^0.9.3","wd":"^0.3.11"},"gh-pages-deploy":{"staticpath":"docs"},"gitHead":"1027024daddac69aa9c4e1c4e94b82bd09cd8bd1","_id":"has-localstorage@1.0.1","_shasum":"fe62406c4767fbd6d784dac6905928108b82971b","_from":".","_npmVersion":"2.1.11","_nodeVersion":"0.10.32","_npmUser":{"name":"gr2m","email":"gregor@martynus.net"},"maintainers":[{"name":"gr2m","email":"gregor@martynus.net"}],"dist":{"shasum":"fe62406c4767fbd6d784dac6905928108b82971b","size":12572,"noattachment":false,"key":"/has-localstorage/-/has-localstorage-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/has-localstorage/download/has-localstorage-1.0.1.tgz"},"publish_time":1420283059455,"_hasShrinkwrap":false,"_cnpm_publish_time":1420283059455,"_cnpmcore_publish_time":"2021-12-16T18:49:07.482Z"},"1.0.0":{"name":"has-localstorage","version":"1.0.0","description":"returns true if localStorage is supported _and_ persistent","main":"lib/has-localstorage.js","directories":{"test":"tests"},"scripts":{"jshint":"jshint -c .jshintrc lib/has-localstorage.js bin/ tests/","test":"npm run jshint && npm run test-browser","test-node":"sh bin/test-node.sh","test-browser":"node ./bin/test-browser.js","dev-server":"http-server -a 127.0.0.1 -p 8000","docs":"doxx --source lib/ --target docs/ --template docs/template.jade","deploy":"gh-pages-deploy "},"repository":{"type":"git","url":"git://github.com/gr2m/has-localstorage"},"keywords":["localstorage","browser","data"],"author":{"name":"Gregor Martynus"},"license":"MIT","bugs":{"url":"https://github.com/gr2m/has-localstorage/issues"},"homepage":"http://gr2m.github.com/has-localstorage","devDependencies":{"chai":"^1.10.0","doxx":"^1.2.1","expect.js":"^0.3.1","gh-pages-deploy":"^0.1.1","http-server":"^0.7.4","jshint":"^2.5.11","mocha":"^2.1.0","request":"^2.51.0","sauce-connect-launcher":"^0.9.3","wd":"^0.3.11"},"gh-pages-deploy":{"staticpath":"docs"},"gitHead":"6efb6b2e3d747d6f571259dee69279d1e9e01a2e","_id":"has-localstorage@1.0.0","_shasum":"457f02f970f11b247fba8deabfb3b5aa67a1af93","_from":".","_npmVersion":"2.1.11","_nodeVersion":"0.10.32","_npmUser":{"name":"gr2m","email":"gregor@martynus.net"},"maintainers":[{"name":"gr2m","email":"gregor@martynus.net"}],"dist":{"shasum":"457f02f970f11b247fba8deabfb3b5aa67a1af93","size":32193501,"noattachment":false,"key":"/has-localstorage/-/has-localstorage-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/has-localstorage/download/has-localstorage-1.0.0.tgz"},"publish_time":1420210647798,"_hasShrinkwrap":false,"_cnpm_publish_time":1420210647798,"_cnpmcore_publish_time":"2021-12-16T18:50:33.105Z"}},"readme":"# has-localstorage\n\n> returns true if localStorage is supported _and_ persistent\n\n[![Build Status](https://travis-ci.org/gr2m/has-localstorage.png?branch=master)](https://travis-ci.org/gr2m/has-localstorage/)\n\nreturns `true` or `false` depending on whether localStorage is supported or not.\nBeware that some browsers like Safari do not support localStorage in private mode.\n\n\n## Downlaod or Installation\n\n- Download [has-localstorage.js](https://raw.githubusercontent.com/gr2m/has-localstorage/master/lib/has-localstorage.js)\n- or: install via Bower: `bower install --save has-localstorage`\n- or: install via npm: `npm install --save has-localstorage`\n\n\n## Usage\n\n```js\nif (hasLocalStorage()) {\n  // localStorage can be used, all data gets persisted\n} else {\n  // localStorage is not available, or changes are not persisted\n}\n```\n\n\n## Help wanted!\n\nThe current test setup is very simple: it only tests in latest Firefox\nusing Selenium and [Sauce Labs](http://saucelabs.com/). Unfortunately,\nSauce Labs has no support to start browsers in private mode, which would\nbe necessary, as `localStorage` behaves different if in private mode\nin Safari, probably in other browsers as well.\n\nIf anynone has an idea to for that, ping me at\nhttps://github.com/gr2m/has-localstorage/issues/1\n\n\n# Acknowledgement\n\n`hasLocalStorage()` has been inspired by this [Cappuccino](http://www.cappuccino-project.org/) commit:\nhttps://github.com/cappuccino/cappuccino/commit/063b05d9643c35b303568a28809e4eb3224f71ec\n\n## License\n\nMIT\n","_attachments":{},"homepage":"http://gr2m.github.com/has-localstorage","bugs":{"url":"https://github.com/gr2m/has-localstorage/issues"},"license":"MIT"}