Yup, it does work when server sets the cookie. Has anyone tried
setting cookies through javascript ? It looks like it doesn't work
atleast on iphone. Maybe because iphone app only exposes
NSHTTPCookieStorage object that manages cookies, while javascript
tries to set them via document.cookie. Any ideas anyone ??
-Mayank
On Jul 14, 12:46 pm, Jesse MacFadyen <
jesse.macfad...@nitobi.com>
wrote:
> To enable cookies in your iPhone PhoneGap application, add the following
> code to your applicationDidFinishLaunching. You can do this on a project by
> project basis, this will likely not be added to PhoneGap directly.
>
> - (void)applicationDidFinishLaunching:(UIApplication *)application
> {
>
> NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage
> sharedHTTPCookieStorage];
> [ cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
> [ super applicationDidFinishLaunching:application ];
>
> }
>
> Yeah, cookies are old-school, but it makes things so much easier for the
> server. If you are interacting with the server via XHR, the server can use
> your cookie to store a sessionID after login, and all future XHR requests
> will not require that you send your credentials around.
>
> I have not tried modifying or setting cookies from JavaScript, just from the
> server. For storing information for use within your application JavaScript,
> localStorage or sessionStorage, or SQLite, or LawnChair are the way to go.
>
> Cheers,
> Jesse
>
> On Wed, Jul 14, 2010 at 10:50 AM, Giacomo Balli <
giacomoba...@gmail.com>wrote:
>
>
>
> > cookies are old school... use localStorage!
>
> > On Jul 14, 3:50 am, WentingLiu <
durianol...@gmail.com> wrote:
> > > works fine on Symbian, but not work on iPhone .
> > > I added these codes too my project according to this Post,http://
> > >
groups.google.com/group/phonegap/browse_thread/thread/f2fb7ecfa47e6a3c/
> > > 551dc45453acc8ed?hl=en&lnk=gst&q=xmlhttp+cookies#551dc45453acc8ed.
> > > NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage
> > > sharedHTTPCookieStorage];
> > > [cookieStorage
> > > setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
>
> > > But it still don't work .Could anyone help? Tks!
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "phonegap" group.
> > To post to this group, send email to
phon...@googlegroups.com
> > To unsubscribe from this group, send email to
> >
phonegap+u...@googlegroups.com<
phonegap%2Bunsu...@googlegroups.com>
>
email:'jesse.macfad...@nitobi.com <
email%3A%27jesse.macfad...@nitobi.com>