ghostCoder
ghostCoder

Reputation: 7655

cookies getting cleared on closing a webapp in android

I am working on a web application for android phones, which is basically few js and html files packaged using Phonegap for android. I am making http requests to the server, getting some cookies (whose life is 10 yrs). These cookies are set by the response header. Now this works fine for this session, the set cookies are sent with each request. But if a quit the app and restart it, the cookies vanish, and are not sent with the request.
The life of the cookies is 10 yrs. Shouldnt they persist? Please tell me where i am getting it wrong?

EDIT-- I tried saving the cookie in an sqlite db, and then setting it properly in document.cookie before making the ajax call. Still its not being sent. Any ideas...?

Upvotes: 3

Views: 2015

Answers (1)

ghostCoder
ghostCoder

Reputation: 7655

Cookies wont persist after the app is closed. Also you cannot directly set the cookies in an xhr object using javascript, according to w3c specifications, so thats why i wasnt able to do that.
the solution would be to re-perform the actions which set the cookies in the cookie jar in the first place.

Upvotes: 1

Related Questions