Find out if cookies are enabled in your browser:
var x = "Cookies Enabled: " + navigator.cookieEnabled;
Click the button to find out if cookies are enabled in your browser.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w ww. j a va2 s . c o m*/ var x = "Cookies enabled: " + navigator.cookieEnabled; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
The cookieEnabled property returns a Boolean value that specifies whether cookies are enabled in the browser.
It returns true if enabled, otherwise it returns false.