title: How to Detect if Cookies Are Disabled on Microsoft Edge / Windows 10?
body: <p>I have some code that works in every other browser, but not in Windows 10 / Microsoft Edge. Any ideas? </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function areCookiesEnabled() {
    // Quick test if browser has cookieEnabled host property
    if (navigator.cookieEnabled) {
      return true;
    }
    // Create cookie
    document.cookie = "cookietest=1";
    var ret = document.cookie.indexOf("cookietest=") !== -1;
    // Delete cookie
    document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
    return ret;
  }
  
  if (areCookiesEnabled()) {
    alert("Cookies are enabled!");
  } else {
    alert("Cookies are not enabled!");
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p><em>Cookies are blocked in settings</em></p>
  
  <p><a href="https://i.stack.imgur.com/xfOBs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xfOBs.png" alt="Cookies are blocked in settings"></a></p>
  
  <p><em>Stack Overflow says that cookies are enabled</em></p>
  
  <p><a href="https://i.stack.imgur.com/tOtfH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tOtfH.png" alt="Stack Overflow says that cookies are enabled"></a></p>