I am trying to detect if the cookies are enabled using Javascript. And my code seems to work for all browsers except Internet Explorer 11.
This is the method I am using
function checkCookie() {
var cookieEnabled = navigator.cookieEnabled;
if (!cookieEnabled){
document.cookie = "testcookie";
cookieEnabled = document.cookie.indexOf("testcookie")!=-1;
}
return cookieEnabled;
}
To detect cookies for IE, I already tried the suggested solutions from
Detect if Cookies are enabled in IE 11 using JS and Check if cookies are enabled
However, even though the cookies (1st party and 3rd party) are disabled, checkCookie()
always returns true
Thank you