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.

Charlie
  • 11,380
  • 19
  • 83
  • 138
  • 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. – Soumya Feb 05 '11 at 02:41
  • 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. – Charlie Feb 05 '11 at 18:20

2 Answers2

3

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

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
  • 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. – Charlie Feb 05 '11 at 18:19
  • 1
    HTML5 local storage currently isn't XSS safe. If you're storing user credentials, you're opening yourself up for attacks. http://michael-coates.blogspot.com/2010/07/html5-local-storage-and-xss.html – Donovan Woodside Apr 06 '11 at 16:06
  • 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? – Charlie Jun 05 '11 at 17:19
  • 1
    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? – hotpaw2 Jun 05 '11 at 17:33
  • Can this be accomplished with a webapp? – Charlie Jun 06 '11 at 00:45
  • 1
    Hybrid. Web app + a bit of native app. If you're using a UIWebview, you have both. – hotpaw2 Jun 06 '11 at 02:30
  • Do you have a link to the corresponding Apple Documentation? Thanks. – Pierre Valade Nov 17 '11 at 17:42
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.