
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
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
}
The current test setup is very simple: it only tests in latest Firefox
using Selenium and Sauce Labs. Unfortunately,
Sauce Labs has no support to start browsers in private mode, which would
be necessary, as localStorage
behaves different if in private mode
in Safari, probably in other browsers as well.
If anynone has an idea to for that, ping me at https://github.com/gr2m/has-localstorage/issues/1
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 1,973 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.