在Phonegap上基于Cookie的身份验证 [英] Cookie based Authentication on Phonegap

查看:182
本文介绍了在Phonegap上基于Cookie的身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临基于phonegap cookie的身份验证的问题:在我强制iPhone关闭我的应用程序(双击物理按钮并关闭)后,我失去了我与服务器建立的cookie。我怎么能避免呢?是否有一些配置?或者一个替代方法吗?

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?

它运行正常,当我第一次运行它,错误只是发生时,我强制关闭应用程序。它在Android上正常工作。

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.

我使用的是:
iPhone - iOS 6.1和
Cordova 2.5

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

感谢

推荐答案

我建议你放弃cookie解决方案,而是切换到 localStorage 解决方案。

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

iOS 6.X对cookie处理没有什么问题,即使Apple修复所有问题,有些人仍然会使用旧版本,旧平台。 Cookie是古老的技术,有一些谈话iOS将在一些未来的版本中失去支持。

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.

另一方面localStorage完全支持HTML5浏览器。

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

你可以更进一步。有一个伟大的js框架,名为 persistance.js 。它会自动为您的设备使用最佳存储选项,并且有4种不同类型的存储解决方案。

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.

这篇关于在Phonegap上基于Cookie的身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆