2

I am using ( navigator.cookieEnabled ) but it gives the result as true even I have selected the option (Block third-party cookies) in my browser can someone tell the way how I can check which type is selected in the cookie option.

Thanks

rizwan
  • 21
  • 2
  • 2
    Does this answer's you question: https://stackoverflow.com/questions/3550790/check-if-third-party-cookies-are-enabled – Sachin Singh Aug 04 '20 at 07:45

1 Answers1

-1

try that :

function testCoockies(){
    var enabled = false;
    // Quick test if browser has cookieEnabled host property
    if (navigator.cookieEnabled){
     enabled = true;
    }
    // Create cookie test
    document.cookie = "testcookie=1";
    enabled = document.cookie.indexOf("testcookie=") != -1;
    // Delete cookie test
    document.cookie = "testcookie=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
    return enabled;
}

It would detect more effectively cookies block

Mbenga
  • 19
  • 3
  • 1
    He wants to detect if third party cookies are enabled. – Sachin Singh Aug 04 '20 at 08:00
  • 1
    it will not work, now simple the question, I want to show an alert if in my browser ("Block third-party cookies") option is selected. in chrome you can find this option into the setting >> privacy and security >> Cookies and other site data>>Block third-party cookies – rizwan Aug 04 '20 at 08:56