Is it possible to retrieve the creation or expiration date of an existing cookie from javascript? If so how?
Thanks, Niro
Is it possible to retrieve the creation or expiration date of an existing cookie from javascript? If so how?
Thanks, Niro
It's impossible. document.cookie
contains information in string like this:
key1=value1;key2=value2;...
So there isn't any information about dates.
You can store these dates in separate cookie variable:
auth_user=Riateche;auth_expire=01/01/2012
But user can change this variable.
The information is not available through document.cookie, but if you're really desperate for it, you could try performing a request through the XmlHttpRequest object to the current page and access the cookie header using getResponseHeader().