2

How do I delete/block third-party cookies for example Facebook or Instagram cookies? This is the code I got so far and is working for cookies on my domain. The cookie "_gid" is removed when clicked. (The "JSESSIONID" Cookie is secure)

$('#disable-cookies').click(function(){
    $('#cookieContent').hide();
    Cookies.set('user-disable-cookies', true, { expires: 100 });
    Cookies.remove('_gid',       { path: '/', domain: '.MYDOMAIN.com' });
    Cookies.remove('JSESSIONID', { path: '/', domain: '.nr-data.net' });
    Cookies.remove('fr',         { path: '/', domain: '.facebook.com' });
    Cookies.remove('csrftoken',  { path: '/', domain: '.api.instagram.com' });
    Cookies.remove('rur',        { path: '/', domain: 'api.instagram.com' });
});

thanks for any help!

nibor90
  • 63
  • 5
  • 1
    Possible duplicate of [Unable to access cookies set by another Domain in IE](https://stackoverflow.com/questions/8433827/unable-to-access-cookies-set-by-another-domain-in-ie) – Taplar Apr 25 '18 at 14:19
  • See the second solution with the PATH attribute in [this SO link](https://stackoverflow.com/questions/10593013/delete-cookie-by-name) – Anu Apr 25 '18 at 14:32

2 Answers2

0

I have tested a lot, but it does not seem to be possible to delete cookies from other domains. However, I have found so far no clear indication that it is not possible. If someone knows exactly, I would be grateful for an answer.

Lazinbee
  • 101
  • 4
-2

$.cookie("name", null, { path: '/' });

mx0
  • 4,605
  • 10
  • 39
  • 47
Naveed
  • 26
  • 4