-1

Why IE 11 could not able to check browser cookie enabled or disabled by using below script?

var browser_cookie = navigator.cookieEnabled;

Is there any way to find out the IE browser cookie is enabled or disabled in settings. I just want to find out in java script

Please help to resolve.

Thanks in advance,

khelwood
  • 55,782
  • 14
  • 81
  • 108
spyga
  • 149
  • 1
  • 7
  • 22

1 Answers1

0

It works for me though.

IE 11 Cookie

But if you want a better way to detect whether cookie is enabled, you can try this, code from:

How to detect that JavaScript and/or Cookies are disabled?

function checkCookie(){
    var cookieEnabled = navigator.cookieEnabled;
    if (!cookieEnabled){ 
        document.cookie = "testcookie";
        cookieEnabled = document.cookie.indexOf("testcookie")!=-1;
    }
    return cookieEnabled || showCookieFail();
}

function showCookieFail(){
  // do something here
}


// within a window load,dom ready or something like that place your:
checkCookie();
Community
  • 1
  • 1
Jamie Phan
  • 796
  • 1
  • 7
  • 26