没有存储的Android jQuery Mobile的饼干 [英] Android JQuery mobile cookies not stored
问题描述
我使用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.
这篇关于没有存储的Android jQuery Mobile的饼干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!