- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when tomcat send back a cookie as flowing:
Cookie cookie = new Cookie(cookieName,token);
cookie.setDomain(domain);
cookie.setPath("/");
cookie.setMaxAge(maxAge);
response.addCookie(cookie);
I can't get cookie through:
var myCookie = document.cookie.replace(/(?:(?:^|.*;\s*)gobaby\s*\=\s*([^;]*).*$)|^.*$/, "$1");
or var xxxs =jqxhr.getAllResponseHeaders();
How to get cookie from tomcat in xdk? and how to send cookie to tomcat in xdk?
peng
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know about other platforms but I did have to jump through some hoops with Android Crosswalk because it uses its own cookie manager that is different from the one used by the browser. I ended up using the CookieMaster plugin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use this way to retrieve:
try { if(typeof(window.localStorage) !== 'undefined') { yourField = window.localStorage.getItem("yourCookieName"); } else { alert('error'); } } catch(err){ alert('error"); } }
And to save:
try { if(typeof(window.localStorage) != 'undefined') { window.localStorage.setItem("yourCookieName", "value"); //alert(1); } else { alert('error'); } }
It works OK on Android Cordova.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page