title: How to intercept a redirection in a popup window?
body: <p>I'm writing a Chrome App which needs user's authorization. Say, a user wants to share a tweet to a website and click on a button. I'll firstly search for the user's access token to that website in the Chrome storage. If not available, I' ll open a window with </p>
  
  <pre><code>window.open(url);
  </code></pre>
  
  <p>where the url is an authorization API provided by the website. Then the user will put in login info (username / password) and be redirected to a callback concatenated by a code required for the access token.</p>
  
  <p>I don't want the user to be redirected and I need that code. 
  How could I intercept that redirection, fetch the code and close the window after a user has finished authorization?</p>