cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Soref <>
Subject RE: Cookie support in docs.
Date Wed, 22 Apr 2015 17:47:27 GMT
Raymond wrote:
> So we don't have a FAQ yet.
> Is it time to start it?

It's long overdue.

> Here is my stab:
> Do cookies work in Cordova apps?
> There are two ways in which you may want to use cookies. The first is
> within XHR (Ajax) requests to remote resources.
> Unless you
> specifically remove them, your Ajax library will automatically use
> cookies in subsequent calls to remote APIs and resources you request.

Some handwaiving necessary to indicate that a cookie set for one domain won't 
be given to an unrelated domain -- yada yada.

> So given that some API returns a cookie required for future calls, you
> can assume it will be automatically sent when your app hits it again.

This overlooks normal cookies that you grow via the server setting them, or 
via a sub-resource using document.cookie.

> The other way your app may desire to use cookies is locally - ie
> within the app itself. This does not make sense within a Cordova app
> as it isn't running on a proper web server itself. If your intent is
> simply to store data for the app then you should make use the various
> existing methods (link to
> l#Storage)
> to store data locally.

Pretty good.

Note that /some/ platforms may have cookie support by accident if they in fact 
are hosted (or temporarily hosted) on a web server. I'm not sure if we want to 
say "you should not expect your app to be able to persist cookies for its own 
use, because generally speaking Cordova applications aren't backed by a web 
server and thus have no place to store cookies" or something like that.

View raw message