web api instance property
Navigator: cookieEnabled property
navigator.cookieEnabled returns a Boolean value that indicates whether cookies are enabled or not.
The property is read-only.
Value
A boolean.
[!NOTE] Web browsers may prevent writing certain cookies in certain scenarios. For example, Chrome-based browsers, as well as some experimental version of Firefox, does not allow creating cookies with
SameSite=Noneattribute, unless they are created over HTTPS and withSecureattribute.
Examples
if (!navigator.cookieEnabled) {
// The browser does not support or is blocking cookies from being set.
}
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.