cookieEnabled
Summary
Retrieves whether client-side persistent cookies are enabled. Persistent cookies are those that are stored on the client-side computer.
Property of dom/Navigatordom/Navigator
Syntax
Note: This property is read-only.
var result = navigator.cookieEnabled;
Return Value
Returns an object of type BooleanBoolean
false (false)
Client does not support cookies or cookies are disabled.
true (true)
Client does support cookies.
Examples
if (!navigator.cookieEnabled) {
// let the user know that enabling cookies makes the web page much more useful
}
Usage
Some websites may require cookies to be enabled on the client in order to work as intended.
eg. a cookie may be used to store a user token that is used to automatically log a user back in when they return visit.
Use navigator.cookieEnabled to determine if the client web browser has cookies enabled. Display a message if they are not and your site requires it.
Notes
Remarks
Note CookieEnabled does not check the status of session cookies. This property does not check whether third-party persistent cookies are enabled.
Syntax
See also
External resources
How to enable cookies in your Web Browser
Attributions
Mozilla Developer Network : [navigator.cookieEnabled Article]
Microsoft Developer Network: [navigator.cookieEnabled Article]