So we don't have a FAQ yet. Is it time to start it? 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.
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.

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
http://cordova.apache.org/docs/en/4.0.0/cordova_storage_storage.md.html#Storage)
to store data locally.

On Wed, Apr 22, 2015 at 9:44 AM, Josh Soref <[email protected]> wrote:
> Andrey:
> It makes sense for someone to write a simple document saying that cookies are
> supported for subresources requested from remote web servers, but that Cordova
> doesn't promise cookie support for the app itself, and it should suggest using
> localStorage or the file API for preferences.
>
> Thanks for volunteering to work on this :)
>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On Behalf Of
>> Andrew Grieve
>> Sent: Wednesday, April 22, 2015 11:18 AM
>> To: dev
>> Subject: Re: Cookie support in docs.
>>
>> Cookies work the same as they do in a browser AFAIK. cookies for file:
>> don't make sense because you talk to a server at file:. If you make an XHR
>> to http:///, they it can set cookies.
>>
>> On Wed, Apr 22, 2015 at 6:12 AM, Andrey Kurdumov
>> <[email protected]>
>> wrote:
>>
>> > Hi,
>> >
>> > I come across the following SO question.
>> >
>> > http://stackoverflow.com/questions/24374397/cookie-support-in-
>> cordova-official-documentation
>> >
>> > The guy could not find any mentions about cookie support in the
>> Phonegap. I
>> > do google search and find that the only mention about cookie support is
>> > issue CB-8026 where stated that Android support third-party cookies. I
>> > personally was having problems with that, but resolve it using custom HTTP
>> > header.
>> >
>> > Question is: Does it make sense add the section in the docs regarding
>> > cookies, and their limitations in Cordova apps, due to fact that files
>> > server over file:/// protocol?
>> >



-- 
===========================================================================
Raymond Camden, Developer Advocate for MobileFirst at IBM

Email : [email protected]
Blog : www.raymondcamden.com
Twitter: raymondcamden

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to