没有存储的Andr​​oid jQuery Mobile的饼干 [英] Android JQuery mobile cookies not stored

查看:93
本文介绍了没有存储的Andr​​oid jQuery Mobile的饼干的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery Mobile的图书馆与Android jquery.cookie.js。的index.html的标题是这样的:

I am using JQuery mobile library with jquery.cookie.js on Android. The header of index.html looks like this:

<link rel="stylesheet" href="css-js/jquery.mobile-1.0a2.min.css" /> 
<script src="css-js/jquery-1.4.4.min.js"></script>
<script src="css-js/jquery.mobile-1.0a2.min.js"></script>
<script src="css-js/jquery.cookie.js"></script>
<script src="css-js/jquery.ba-dotimeout.js"></script> 

其他一切工作,除了存储和检索的cookie。

Everything else works except storing and retrieving cookies.

在code来存储它们看起来像

The code to store them looks like

var tmp = 'abc'
$.cookie(COOKIE_NAME, tmp);

在code检索的样子

The code to retrieve looks like

var stored = $.cookie(COOKIE_NAME)

和我敢肯定,有没有加入空或空值。我已设置

And i'm sure there are no empty or null values added. I have set

mWebView.getSettings().setDomStorageEnabled(true);

对于web视图。

for the WebView.

这可能是什么问题,或者有什么能调试的好方法?

What could be the problem, or what could be a good way to debug it?

推荐答案

该问题可能与事实,你不设置路径:

The issue may be related to the fact that you are not setting a path:

$.cookie(COOKIE_NAME, tmp, { path: '/' });

不带路径,我认为浏览器默认为当前路径(你在任何网页),并尽快你去到另一个页面时,cookie是unaccessable。

Without the path, I believe the browser defaults to the current path (whatever page you are on), and as soon as you go to another page, the cookie is unaccessable.

这篇关于没有存储的Andr​​oid jQuery Mobile的饼干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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