Is it possible to get page redirect information via Ajax?
<p>Without ajax, if we load <code>http://example.com/1</code> and if it redirects to <code>http://example.com/2</code> then the browser gets appropriate headers and the Browser URL get's updated. Is there a way to get this information via jQuery Ajax?</p>

<p>For example, I am requesting  <code>http://api.example.com</code> via Ajax. In PHP, this page is redirected to <code>http://api2.example.com</code>. Is it possible to know this thing?</p>

<p><strong>Use:</strong>
I have a navbar which has links. All pages are <strong>loaded into the container via AJAX</strong> and I push the url on Browser Bar using HTML5 history as per the link. </p>

<p>However, if the page gets redirected, the page would have a new link right? I would like to change that in the Browser bar too. I would like to know where the Ajax URL is redirected in case it is redirected.</p>

<p><strong>Why this is important?</strong>
My links handle form data, requests and various authentications. For example, if I request, <code>https://oauth.example.org?code=56hycf86</code> it either redirects to <code>success</code> or <code>failure</code> page. My Ajax get the right html content but the URL browser bar still has the URL with same <code>Auth ID</code> which, if reloaded, produces error. There are other security issues too.</p>

<p>I do not know if I explained things right, but thanks for your help. </p>