$ .removeCookie does not delete cookies in Chrome

$. removeCookie does not delete cookies in Chrome.

Please refer to the screenshot below. Screenshot taken from Chrome settings → All cookies and site.

enter image description here

The above screenshot clearly shows that one cookie is available (name :! Proxy! ProxyJSESSIONID and path: / stockquote / rest / auth). But when

$.removeCookie('!Proxy!proxyJSESSIONID', { path: '/stockquote/rest/auth'});
Performed

it returns false and does not delete the cookie .

enter image description here

I am using jQuery Cookie Plugin v1.4.1.

+4
source share
4 answers

Finally, I found an alternative.

$.cookie('!Proxy!proxyJSESSIONID', '', { expires: -1, path: '/stockquote/rest/auth'});
  • Setting the value as empty ('') and
  • : -1

$. removeCookie .

+1

cookie jQuery, null:

$.removeCookie('filter', { path: '/' });
+4

To delete a cookie, set it to null

$.cookie("!Proxy!proxyJSESSIONID", null, { path: '/stockquote/rest/auth' });

And he will be deleted

+1
source

Always use the path when setting cookies. By default, cookies are stored according to the pages.

//Set value to cookie
$.cookie('key', 'value', { path: '/your/path'});

//remove value from cookie
$.removeCookie('key', { path: '/your/path' });
0
source

Source: https://habr.com/ru/post/1621438/


All Articles