title: URL forwarding using Chrome webRequest after response is received
body: <p>I am attempting to create a Chrome extension that utilizes Chrome's <a href="http://developer.chrome.com/extensions/webRequest.html" rel="noreferrer">webRequest</a> module to perform a redirect to a URL obtained from an initially accessed URL. For this I would like to utilize only Chrome's webRequest functions (e.g., onBeforeSendHeaders, onHeadersReceived) and not simply perform a call to $.ajax() with the obtained URL. The desired functionality is:</p>
  
  <ol>
  <li>User enters a URL in the address bar</li>
  <li>A request is made and the secondary URL is extracted from the HTTP response</li>
  <li>The <a href="http://developer.chrome.com/extensions/webRequest.html#event-onHeadersReceived" rel="noreferrer">chrome.webRequest.onHeadersReceived</a> handler redirects the user to this secondary URL using the redirectUrl attribute of a blocking response.</li>
  </ol>
  
  <p>My attempt at accomplishing this is:</p>
  
  <pre><code>chrome.webRequest.onHeadersReceived.addListener(
   function(details){
    var secondaryURL = extractSecondaryURL(details);
    return {redirectUrl: secondaryURL}; //this doesn't work
   },
   {urls:["http://*/*", "https://*/*"]},
   ["blocking","responseHeaders"]
  );
  </code></pre>
  
  <p>...but the page is never forwarded. The webRequest documentation says, "Only used as a response to the onBeforeRequest event." about the <em>redirectUrl</em> attribute, which is the likely culprit.</p>
  
  <p>How does one perform this sort of forwarding using data received from the response headers and the Chrome webRequest module?</p>