Best way to check if cookies are enabled in browser


I’ve created a Meteor Angular project.
When the browser’s cookies are disabled the browser console shows:

You are running a browser with no localStorage or userData support. Logging in from one tab will not cause another tab to be logged in.

Is there a recommended way of checking that cookies are enabled and then displaying a message to the user to enable it?


Set a cookie variable. Then immediately retrieve the cookie and check the value.

Hi @rjdavid,

Thanks for the reply.

I ended up using the following code to check if the browser cookie is enabled when they attempt to log in:

    var cookieEnabled = (navigator.cookieEnabled) ? true : false;
    if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled)
      cookieEnabled = (document.cookie.indexOf("testcookie") != -1) ? true : false;
    return (cookieEnabled);

If cookies are disabled, I flow to a view informing the user to enable cookies and log them out.

1 Like

This is in my backlog and I’ll be copying your code. :slight_smile:

Linking to your post