Delete Secure Third Party Cookie (not HttpOnly)

23 views Asked by At

I trying to delete a cookie and my function is working for some cookies but not the one I want to delete.

Dummy details of the cookie:

Name: xyzabc, Value: 1, Path: /, Domain: .abcd.com (third party domain), Expiry: 2024-09-12T19:57:15.000Z, httpOnly: No, Secure: Yes,

Function I am using:

function deleteCookies(cookieNames) {
for (var i = 0; i < cookieNames.length; i++) {
document.cookie = cookieNames[i] + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;domain=.abcd.com';
}
}

var cookiesToDelete = ['xyzabc'];
deleteCookies(cookiesToDelete);

Is there any reason this is not working for the above cookie with a same configuration?

Hoping xyzabc would get deleted but it doesn't. I tried it with two other non secure and non httpOnly cookie and those got deleted

0

There are 0 answers