title: Stopping navigation in Chrome (google chrome extension)
body: <p>My goal: When I click a link, stop all requests <strong>and</strong> the browser from navigating to that link. Essentially, if i clicked the link <a href="http://tabbit.org/about" rel="nofollow noreferrer">http://tabbit.org/about</a>, nothing would happen. no requests, no navigation, nothing.</p>
  
  <p>I am successfull in stopping the requests with "onBeforeRequest" listener, but the browser still tries to navigate to the href's value, giving me a page that says <em>"This webpage was blocked by an extension"</em></p>
  
  <p>What I have tried </p>
  
  <pre><code>var navigate = true;
  var url = "http://tabbit.org/about"
  
  /*
   * Will prevent headers from being sent. Browser will still
   * try to navigate to the clicked link, though.
   */
  chrome.webRequest.onBeforeRequest.addListener(
      function(details) {
          navigate = false;
          return {cancel: true} ;
      },
      // filters
      {urls: [url]},
  
       ["blocking"]
    );
  
  
  // Somewhere in here is where I think navigation needs to be stopped.
  chrome.webNavigation.onBeforeNavigate.addListener(
      function(details) {
          if (navigate == false) {
              return false; // doesn't work.
              //return {cancel: true}; // doesn't work.
          };  
      },
      {urls: [url]},
      ["blocking"]
  )
  </code></pre>
  
  <p>I didn't want to use a content script because I want do this for forms as well.
  So basically if an http request is made to a certain URL, GET or POST, i'd like for nothing to happen.</p>
  
  <p>I have browsed  <a href="https://stackoverflow.com/questions/8505295/google-chrome-extension-stop-browser-navigation">SO</a> (and web) for a solution, but no dice.</p>