开发者

Django user.is_authenticated via ajax works in WebKit but not Firefox

开发者 https://www.devze.com 2023-04-11 02:56 出处:网络
I\'m sending a cross-domain jsonp request to /isauthenticated, which routes to a function that returns user.is_authenticated (0 or 1). It works great in WebKit, but returns 0 every time in Firefox 5-7

I'm sending a cross-domain jsonp request to /isauthenticated, which routes to a function that returns user.is_authenticated (0 or 1). It works great in WebKit, but returns 0 every time in Firefox 5-7, even when I'm clearly logged in. If I copy the url that ajax sends (including ?callback=callback) and paste it in the browser, it works as it should.

Do I need different headers or something for Firefox ajax?

Here's my ajax call right now.

$.ajax({
    url: domain + '/account/isauthenticated/',
    dataType: 'jsonp',
    success: function(data) {
       if(data === 0) {
          //Not logged in, every time in Firefox
       } else if(data == 1) {
          //logged in
       }
    开发者_运维问答}
});

Thank you!


3rd party cookies were being blocked in the browser settings. Duh.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号