Android jQuery mobile cookies not saved

I am using jQuery mobile library with jquery.cookie.js on Android. The index.html header 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> 

Everything else works except save and receive cookies.

The code to save them looks like

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

The resulting code looks like

 var stored = $.cookie(COOKIE_NAME) 

And I'm sure no null or null values ​​have been added. I have installed

 mWebView.getSettings().setDomStorageEnabled(true); 

for webview.

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

+4
source share
1 answer

The problem may be due to the fact that you are not setting the path:

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

Without a path, I assume that the browser uses the current path by default (no matter which page you are on), and as soon as you go to another page, the cookie will not be available.

+3
source

All Articles