Extjs : How to ‘real’ clear a cookie

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…

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

  • 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 to test Cancel reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

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