Cookie based Authentication on Phonegap

依然范特西╮ 提交于 2019-12-23 12:05:40

问题


I'm facing a problem with phonegap cookie based authentication: After i force the iPhone to close my app (double click on the physical button and close), i lose the cookie that i established with the server. How can i avoid it? Is there some configuration? Or an alternative way for it?

It works normally when i run it for the first time and the error just happens when i force close the app. It works normally on android.

I'm using: iPhone - iOS 6.1 and Cordova 2.5

Thanks


回答1:


I would advice you to abandon cookie solution and instead to switch to localStorage solution.

iOS 6.X has few problems with cookie handling and even if Apple fix all problems some people will still use older version thus making your app unusable on older platforms. Cookies are archaic technology and there are some talks iOS will loose the support in some future versions.

On the other hand localStorage is fully supported on HTML5 browsers.

You can go even further that that. There's a great js framework called persistance.js. It will automatically use best storage option for your device and there are 4 different kinds of storage solution.



来源:https://stackoverflow.com/questions/16463188/cookie-based-authentication-on-phonegap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!