iPhone/iPad WebApps don't allow cookies?
Asked Answered
B

2

8

When I use <meta name="apple-mobile-web-app-capable" content="yes">, my page doesn't set, load, or retrieve cookies. Is there any way to get around this? I can't find anything useful in Google.

Bromley answered 5/2, 2011 at 0:44 Comment(2)
Could you be more specific about how you set/retrieve cookies? I have made a web app for the iPad and cookies worked fine with JavaScript.Lamina
I use the jQuery cookie script to set/retrieve cookies. It works fine without the 'apple-mobile-web-app-capable' code but with it it doesn't work.Bromley
J
3

UIWebviews don't store cookies. Use HTML5 local storage instead.

Jackofalltrades answered 5/2, 2011 at 2:43 Comment(7)
I would use localstorage but I have a number of scripts including one that uses authentication that stores information in cookies and it would be too cumbersome to change the scripts over.Bromley
HTML5 local storage currently isn't XSS safe. If you're storing user credentials, you're opening yourself up for attacks. michael-coates.blogspot.com/2010/07/…Cordless
So what's the best way to do this? If cookies don't work with UIWebviews and localstorage is not safe, what else is there?Bromley
Maybe store credential cookies outside the webview in the keychain using native code? Then pass them back to known website URLs directly using CF network calls as needed when prompted from the web view?Jackofalltrades
Can this be accomplished with a webapp?Bromley
Hybrid. Web app + a bit of native app. If you're using a UIWebview, you have both.Jackofalltrades
Do you have a link to the corresponding Apple Documentation? Thanks.Honig
T
2

There is a small bug in the comment on the first line of jquery.cookie.js that iPads don't like.

Change /*! to /* on line 1.

Triglyceride answered 3/7, 2012 at 13:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.