title: Keycode not working in chrome extension
body: <p>I am writing a chrome extension which should change the content-type of http responses. It is working fine. Now, I want to control it using keypress i.e. user should be able to bypass the default action of extension on keypress. I tried this, but it doesn't work:</p>
  
  <p><strong>background.js</strong></p>
  
  <pre><code>var enableEXT = true;
  window.onkeydown = function() 
  {
      console.log('Testing hello');
      if (event.keyCode == 70)
          enableEXT = false;
      console.log(event.keyCode);
      console.log(enableEXT);
  };
  window.onkeyup = function() 
  {
      enableEXT = true;
      console.log(event.keyCode);
  };
  chrome.webRequest.onHeadersReceived.addListener(function(details) {
  for (var i = 0; i &lt; details.responseHeaders.length; ++i) 
  {
      if (details.responseHeaders[i].name.toLowerCase() == 'content-type' &amp;&amp; !enableEXT)
          details.responseHeaders[i].value = 'application/xyz';
  }
  return {responseHeaders: details.responseHeaders};
  }, {urls: ["&lt;all_urls&gt;"]}, ['blocking', 'responseHeaders']);
  </code></pre>