You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Andrey Kurdumov <ka...@googlemail.com> on 2015/04/22 12:12:14 UTC

Cookie support in docs.

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?

Re: Cookie support in docs.

Posted by Raymond Camden <ra...@gmail.com>.
Any particular version? I've never had a problem with this in the past (afaik).

On Mon, May 4, 2015 at 1:16 AM, julio cesar sanchez
<jc...@gmail.com> wrote:
> I've just read this topic on the google group
>
> https://groups.google.com/forum/#!topic/phonegap/0EnQJBPA0uA
>
> On the FAQ you can read:
>
> "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."
>
> But it seems it isn't true on android
>
>
> 2015-04-23 5:26 GMT+02:00 Andrey Kurdumov <ka...@googlemail.com>:
>
>> I put section about CORS, since looks like not everybody unaware that CORS
>> applied to all remote communicatoins.
>>
>> https://github.com/cordova/cordova-discuss/pull/1
>>
>> Please take a look.
>>
>> 2015-04-23 3:01 GMT+06:00 Raymond Camden <ra...@gmail.com>:
>>
>> > Sweet. Thanks Shazon!
>> >
>> > On Wed, Apr 22, 2015 at 1:58 PM, Shazron <sh...@gmail.com> wrote:
>> > > Created https://github.com/cordova/cordova-discuss/blob/master/FAQ.md
>> > > as a doc so we can stage edits.
>> > > If anyone needs direct access let me know.
>> > >
>> > >
>> > > On Wed, Apr 22, 2015 at 10:21 AM, Raymond Camden
>> > > <ra...@gmail.com> wrote:
>> > >> 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 <js...@blackberry.com>
>> > 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: agrieve@google.com [mailto:agrieve@google.com] 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
>> > >>>> <ka...@googlemail.com>
>> > >>>> 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 : raymondcamden@gmail.com
>> > >> Blog : www.raymondcamden.com
>> > >> Twitter: raymondcamden
>> > >>
>> > >> ---------------------------------------------------------------------
>> > >> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
>> > >> For additional commands, e-mail: dev-help@cordova.apache.org
>> > >>
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
>> > > For additional commands, e-mail: dev-help@cordova.apache.org
>> > >
>> >
>> >
>> >
>> > --
>> >
>> ===========================================================================
>> > Raymond Camden, Developer Advocate for MobileFirst at IBM
>> >
>> > Email : raymondcamden@gmail.com
>> > Blog : www.raymondcamden.com
>> > Twitter: raymondcamden
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
>> > For additional commands, e-mail: dev-help@cordova.apache.org
>> >
>> >
>>



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

Email : raymondcamden@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Re: Cookie support in docs.

Posted by julio cesar sanchez <jc...@gmail.com>.
I've just read this topic on the google group

https://groups.google.com/forum/#!topic/phonegap/0EnQJBPA0uA

On the FAQ you can read:

"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."

But it seems it isn't true on android


2015-04-23 5:26 GMT+02:00 Andrey Kurdumov <ka...@googlemail.com>:

> I put section about CORS, since looks like not everybody unaware that CORS
> applied to all remote communicatoins.
>
> https://github.com/cordova/cordova-discuss/pull/1
>
> Please take a look.
>
> 2015-04-23 3:01 GMT+06:00 Raymond Camden <ra...@gmail.com>:
>
> > Sweet. Thanks Shazon!
> >
> > On Wed, Apr 22, 2015 at 1:58 PM, Shazron <sh...@gmail.com> wrote:
> > > Created https://github.com/cordova/cordova-discuss/blob/master/FAQ.md
> > > as a doc so we can stage edits.
> > > If anyone needs direct access let me know.
> > >
> > >
> > > On Wed, Apr 22, 2015 at 10:21 AM, Raymond Camden
> > > <ra...@gmail.com> wrote:
> > >> 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 <js...@blackberry.com>
> > 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: agrieve@google.com [mailto:agrieve@google.com] 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
> > >>>> <ka...@googlemail.com>
> > >>>> 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 : raymondcamden@gmail.com
> > >> Blog : www.raymondcamden.com
> > >> Twitter: raymondcamden
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> > >> For additional commands, e-mail: dev-help@cordova.apache.org
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> > > For additional commands, e-mail: dev-help@cordova.apache.org
> > >
> >
> >
> >
> > --
> >
> ===========================================================================
> > Raymond Camden, Developer Advocate for MobileFirst at IBM
> >
> > Email : raymondcamden@gmail.com
> > Blog : www.raymondcamden.com
> > Twitter: raymondcamden
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> > For additional commands, e-mail: dev-help@cordova.apache.org
> >
> >
>

Re: Cookie support in docs.

Posted by Andrey Kurdumov <ka...@googlemail.com>.
I put section about CORS, since looks like not everybody unaware that CORS
applied to all remote communicatoins.

https://github.com/cordova/cordova-discuss/pull/1

Please take a look.

2015-04-23 3:01 GMT+06:00 Raymond Camden <ra...@gmail.com>:

> Sweet. Thanks Shazon!
>
> On Wed, Apr 22, 2015 at 1:58 PM, Shazron <sh...@gmail.com> wrote:
> > Created https://github.com/cordova/cordova-discuss/blob/master/FAQ.md
> > as a doc so we can stage edits.
> > If anyone needs direct access let me know.
> >
> >
> > On Wed, Apr 22, 2015 at 10:21 AM, Raymond Camden
> > <ra...@gmail.com> wrote:
> >> 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 <js...@blackberry.com>
> 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: agrieve@google.com [mailto:agrieve@google.com] 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
> >>>> <ka...@googlemail.com>
> >>>> 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 : raymondcamden@gmail.com
> >> Blog : www.raymondcamden.com
> >> Twitter: raymondcamden
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> >> For additional commands, e-mail: dev-help@cordova.apache.org
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> > For additional commands, e-mail: dev-help@cordova.apache.org
> >
>
>
>
> --
> ===========================================================================
> Raymond Camden, Developer Advocate for MobileFirst at IBM
>
> Email : raymondcamden@gmail.com
> Blog : www.raymondcamden.com
> Twitter: raymondcamden
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> For additional commands, e-mail: dev-help@cordova.apache.org
>
>

Re: Cookie support in docs.

Posted by Raymond Camden <ra...@gmail.com>.
Sweet. Thanks Shazon!

On Wed, Apr 22, 2015 at 1:58 PM, Shazron <sh...@gmail.com> wrote:
> Created https://github.com/cordova/cordova-discuss/blob/master/FAQ.md
> as a doc so we can stage edits.
> If anyone needs direct access let me know.
>
>
> On Wed, Apr 22, 2015 at 10:21 AM, Raymond Camden
> <ra...@gmail.com> wrote:
>> 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 <js...@blackberry.com> 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: agrieve@google.com [mailto:agrieve@google.com] 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
>>>> <ka...@googlemail.com>
>>>> 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 : raymondcamden@gmail.com
>> Blog : www.raymondcamden.com
>> Twitter: raymondcamden
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
>> For additional commands, e-mail: dev-help@cordova.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> For additional commands, e-mail: dev-help@cordova.apache.org
>



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

Email : raymondcamden@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Re: Cookie support in docs.

Posted by Shazron <sh...@gmail.com>.
Created https://github.com/cordova/cordova-discuss/blob/master/FAQ.md
as a doc so we can stage edits.
If anyone needs direct access let me know.


On Wed, Apr 22, 2015 at 10:21 AM, Raymond Camden
<ra...@gmail.com> wrote:
> 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 <js...@blackberry.com> 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: agrieve@google.com [mailto:agrieve@google.com] 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
>>> <ka...@googlemail.com>
>>> 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 : raymondcamden@gmail.com
> Blog : www.raymondcamden.com
> Twitter: raymondcamden
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> For additional commands, e-mail: dev-help@cordova.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Re: Cookie support in docs.

Posted by Raymond Camden <ra...@gmail.com>.
Do we need to say the domain/cookie thing when that is standard cookie
behavior? I think most folks know a cookie set by A.com won't be
usable via B.com. (Then again, repeating such things wouldn't hurt.)

On Wed, Apr 22, 2015 at 10:47 AM, Josh Soref <js...@blackberry.com> wrote:
> 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
>> http://cordova.apache.org/docs/en/4.0.0/cordova_storage_storage.md.htm
>> 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.



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

Email : raymondcamden@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


RE: Cookie support in docs.

Posted by Josh Soref <js...@blackberry.com>.
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
> http://cordova.apache.org/docs/en/4.0.0/cordova_storage_storage.md.htm
> 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.

Re: Cookie support in docs.

Posted by Raymond Camden <ra...@gmail.com>.
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 <js...@blackberry.com> 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: agrieve@google.com [mailto:agrieve@google.com] 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
>> <ka...@googlemail.com>
>> 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 : raymondcamden@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


RE: Cookie support in docs.

Posted by Josh Soref <js...@blackberry.com>.
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: agrieve@google.com [mailto:agrieve@google.com] 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
> <ka...@googlemail.com>
> 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?
> >

Re: Cookie support in docs.

Posted by Andrew Grieve <ag...@chromium.org>.
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 <ka...@googlemail.com>
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?
>