First, I\'m working in Google Chrome, if that helps. Here is the behavior:
I send an xhr request via jQuery to a remote site (this is a chrome Extension, and I\'ve set a
You could try the type of solution described here: How to manage a redirect request after a jQuery Ajax call
That means in fact superseding HTTP protocol, you'll need to control the server as well. All ajax responses will be in code 200 (or at least the 3xx ones, not the 401/403) with a json object. and in this json object you can provide some special error code (why not reusing
Then you extends jQuery.ajax function to capture theses special codes in your json response and make the new requests needed. In fact the automatic jQuery redirect call is done by you and not by jQuery.
at first this seems ugly, but when dealing with problems like the one suggested in the link (end of session, redirect on login page) it seems that having a complete protocol handling in your ajax json communications between the client and the server is not a bad idea.