i writing couchapp, uses couch.jquery.js library.
when login site ie8, successful login (it returns ok, , login id), when query session, userctx.name of null (just if login didn't happen).
it seem explorer not keep cookie login. have info on this? have tried j chris's couchlogin.js library , written own login scripts same problem.
the session code is:
$.couch.session({ success: function(data) { console.log(json.stringify(data)); } });
response ie:
{"ok":true,"userctx":{"name":null,"roles":[]},"info":{"authentication_db":"_users","authentication_handlers":["oauth","cookie","default"]}}
response firefox / chrome:
{"ok":true,"userctx":{"name":"user1","roles":[]},"info":{"authentication_db":"_users","authentication_handlers":["oauth","cookie","default"],"authenticated":"cookie"}}
i have solved editing jquery.couch.js, , adding cache:false ajax call in session function.
session: function(options) { options = options || {}; $.ajax({ cache: false, //disable caching ie type: "get", url: this.urlprefix + "/_session", beforesend: function(xhr) { xhr.setrequestheader('accept', 'application/json'); }, complete: function(req) { var resp = $.parsejson(req.responsetext); if (req.status == 200) { if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { throw "an error occurred getting session info: " + resp.reason; } } }); }
Comments
Post a Comment