A simple, lightweight JavaScript API for handling browser cookies with extensive browser support and no dependencies.
JavaScript Cookie is a lightweight, dependency-free library for handling browser cookies in JavaScript. It provides a simple API to set, get, and delete cookies, abstracting the native `document.cookie` interface with robust cross-browser support and RFC 6265 compliance. It solves the problem of inconsistent and verbose cookie management across different browsers.
Frontend and full-stack JavaScript developers who need reliable, cross-browser cookie operations for features like user sessions, authentication, preferences, and tracking in web applications.
Developers choose JavaScript Cookie for its minimal size, zero dependencies, and extensive browser compatibility. Its clean API and adherence to standards make it a trusted, straightforward alternative to manual cookie handling or heavier utility libraries.
A simple, lightweight JavaScript API for handling browser cookies
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works reliably across all major browsers, including legacy versions, as highlighted in the features, ensuring consistent behavior without polyfills.
At less than 800 bytes gzipped with zero dependencies, it adds negligible overhead to web applications, prioritizing performance and simplicity.
Adheres to RFC 6265 for cookie interoperability, reducing cross-browser issues and ensuring correct handling of special characters via percent-encoding.
Provides fine-grained management of expires, path, domain, secure, sameSite, and partitioned attributes, with global defaults via withAttributes().
Cannot read cookies by specifying domain or path attributes during get() calls, requiring developers to manually manage cookie visibility and leading to potential bugs.
Lacks built-in security features like encryption or automatic HttpOnly flag setting, placing the burden on developers to implement secure practices correctly.
Deleting cookies requires passing exact matching attributes, as warned in the README, which can cause failures if not meticulously implemented.