Getting url after redirect from JavaScript
<p>I have the following Java code:</p>

<pre><code>        URL url = new URL(destUrl);
        HttpURLConnection c = (HttpURLConnection) url.openConnection();
        c.setRequestMethod("GET");
        c.setInstanceFollowRedirects(false);
        c.connect();
        String location = c.getHeaderField("Location");
        c.disconnect();
</code></pre>

<p>destUrl does a redirect, and I get the URL that it redirected to and put in the string location.  That's really the whole point...I just need to know the URL that gets redirected to.</p>

<p>The code above works great, but I now need to port this to JavaScript or jQuery for a Chrome extension I'm writing.  I've tried numerous methods but so far haven't been successful.  </p>

<p>What's the best approach to accomplish this?</p>