1

私はcouch.jquery.jsライブラリを使用するcouchappを書いています。

ie8 でサイトにログインすると、ログインに成功します (OK とログイン ID が返されます) が、セッションをクエリすると、null の userCtx.name が返されます (ログインが行われなかった場合と同様)。 )。

エクスプローラーはログインから Cookie を保持しないようです。誰もこれに関する情報を持っていますか?J ChrisのcouchLogin.jsライブラリを試し、同じ問題で独自のログインスクリプトを作成しました。

セッションコードは次のとおりです。

$.couch.session({
    success: function(data) {
        console.log(JSON.stringify(data));
    }
});

IE からの応答:

{"ok":true,"userCtx":{"name":null,"roles":[]},"info":{"authentication_db":"_users","authentication_handlers":["oauth","cookie","default"]}}

Firefox / Chrome からの応答:

{"ok":true,"userCtx":{"name":"user1","roles":[]},"info":{"authentication_db":"_users","authentication_handlers":["oauth","cookie","default"],"authenticated":"cookie"}}
4

1 に答える 1

0

jquery.couch.js を編集し、セッション関数の ajax 呼び出しに cache:false を追加することで、これを解決しました。

session: function(options) {
  options = options || {};
  $.ajax({
    cache: false,  //disable caching for 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;
      }
    }
  });
}
于 2013-03-21T22:21:59.703 に答える