phonegap / cordova集和获取cookie的登录 [英] phonegap / cordova set and get cookies for login

查看:582
本文介绍了phonegap / cordova集和获取cookie的登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的自适应网站有一个经典的登录,会话Cookie在我的手机应用程序中加载。现在,当我通过应用程序登录到我的网站时,会话被存储,我可以使用cookie信息。当我关闭应用程序并重新启动它时,会话cookie消失了,我必须重新登录。

My responsive website has a classic login with session cookies that load within my phonegap App. Now, when I login to my website via App, the session is stored and I can use the cookie information. When I'm to close the App and restart it, the session cookies are gone and I must login again.

注意:我在应用程序中使用该解决方案加载我的网站

Note: I use that solution inside the App to load my website

window.open(www.domain.com) 


推荐答案

您的问题是关联到WebView cordova(它使用浏览器引擎,但它不是一个浏览器)。
Cordova似乎不支持它。

your problem is releated to the WebView cordova (it use the browser engine but it isn't a browser). Cordova seems to not support it.

因此,我建议您更改cordova应用程序中的逻辑,它不是一个网站,而是一个移动应用程序,请尝试按此处回答。

For this reason i suggest you to change the logic in your cordova application, it isn't a website but a mobile application, try to follow the answer here.

如果您想使用相同的代码库尝试检查您是否在移动应用程序和fork逻辑使用浏览器上下文中的cookie和 localStorage 在WebView上下文中。

If you want to work with the same codebase try to check if you are on mobile application and fork the logic to use cookies in browser context and localStorage in WebView context.

这篇关于phonegap / cordova集和获取cookie的登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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