title: Listener to change url before loading it on Mozilla SDK
body: <p>I'm trying to get something similar to a typo correction for the location bar on mozilla sdk. The user inputs a url on the locationbar and it gets changed before it is loaded. I've tried:</p>
  
  <p>sdk/pagemod as seen <a href="https://stackoverflow.com/questions/21258449/how-to-get-url-of-a-tab-before-the-page-gets-loaded-in-mozilla-addon-sdk">here</a>. The problem is it runs when the page starts rendering, not before it starts downloading it.</p>
  
  <p>sdk/tabs => It doesn't have a event that gets called before it starts loading a website.</p>
  
  <p>Above is what I've found that would catch websites the user is trying to enter into. I have also found <a href="https://developer.mozilla.org/en-US/docs/Observer_Notifications" rel="nofollow">sdk/system/events</a>, but the only event I found I could use is http-on-modify-request, this does catch every http request. The problem is, you can't modify the url of that request.</p>
  
  <p>To solve this I've seen 2 options:</p>
  
  <p><a href="https://github.com/matagus/remove-google-redirects-addon/blob/master/lib/main.js" rel="nofollow">This addon's way</a> => Get the current tab and load there the new url. The problem is clear, the request may not be from a url the user is trying to load, but from a url inside a page's html. I tried comparing the request url to tabs.activeTab.url, but it gets set after the http-on-modify-request event is sent.</p>
  
  <p>or the solution explained <a href="https://stackoverflow.com/questions/5205672/modify-url-before-loading-page-in-firefox">here</a> that I am not sure could work (it is not for mozilla sdk).</p>
  
  <p>So basically my problem right now could be solved with:</p>
  
  <p>-a way to capture the url from the location bar before it starts loading &amp; changing it (I haven't seen anything for this on the sdk) or
  -a way to know when a request corresponds to a website the user is trying to load in the location bar or
  -a way to modify the request (url)</p>