If you are in extjs application designing and coding, you might need to use use ‘Ext.util.Cookies.*’ function.
You can :

  • Ext.util.Cookies.get(‘my_cookie’) : get cookie value
  • Ext.util.Cookies.get(‘my_cookie’, ‘cookie_value’) : set cookie value
  • Ext.util.Cookies.clear(‘my_cookie’) : clear cookie

In theory you can delete cookie by means of ‘clear’ function.

In practice, you should use :

Ext.util.Cookies.set('my_cookie', null, new Date("January 1, 1970"));
Ext.util.Cookies.clear('my_cookie');

Because you can be faced to a problem where you cannot delete your cookie and cannot understand why…

Extjs : How to ‘real’ clear a cookie

3 thoughts on “Extjs : How to ‘real’ clear a cookie

  • May 5, 2011 at 4:06 pm
    Permalink

    made my day … because I "cannot delete the cookie and cannot understand why" 😉

    Reply
  • June 9, 2011 at 11:41 pm
    Permalink

    in set cookie: it's Ext.util.Cookies.set('my_cookie', 'cookie_value')

    Reply
  • May 15, 2013 at 2:50 pm
    Permalink

    I have a window for which I am using state (for position). there is a button in my interface which allows the user to reset the position of the window. however, if the window doesn’t exist, I want to delete the cookie for it so that when created, its shown at its original location. However, this doesnt seem to work. The cookies are deleted using your method but when the window is created, it somehow restores the state (and recreates the cookie). any suggestions?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.