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
As Rajiv M. has stated above, you cannot catch 302 redirects using an XHL Object or AJAX request.
Your best bet is to setup a proxy of some kind in PHP/ASP or whatever server-side scripting language. The PHP script will simply follow 302 redirects until it reaches a final destination. Then, it can send the final URL back to your JavaScript page. Now future AJAX requests can be sent directly to the known final URL.
Or...
Your PHP script will just serve as a proxy. All requests will be sent to this PHP script.
Or...
Just hardcode the final URL into your JavaScript application, if possible (although I assume that it's not possible in your case).
Sorry -- I hate the "you can't do this" answers, too, but there are some JavaScript limitations that haven't quite been ironed out yet.