I am working on CAKE PHP 2.5.x
and if user session expired then I throw 401 unauthorized
exception in response to HTTP/AJAX
request.
Now, if I logged out meanwhile and browser sends AJAX
request to server. So in such case server sends 401
exception.
$( document ).ajaxError(function(x,e){
if(e.status == "401"){
alert('requested restricted area!');
window.location.reload();
}
});
From above code, I am handling 401
thrown via AJAX
. This is working fine in chrome
.
But I don't know firefox
is getting response 403 Forbidden
for same scenario and due to this my check for unauthorized fails.
P.S. AJAX
call is on same domain
and also no authentication for each AJAX
call. I simply check if user logged or not on server side.
Can you please help me out. Thank you in advance.