title: Is there Javascript keydown restriction while changing browser url?
body: <p>I tried to add a keydown event with javascript that refreshes page. But it did not work. The same code works perfectly on button click event. How to achieve reloading page with keydown event? The page needs to be loaded with GET, even if the page first was loaded with POST, so window.location.reload() doesn't work.</p>
  
  <p>This issue is happening with FF 4. I haven't tried other browsers yet.</p>
  
  <p>The code that does NOT work is:</p>
  
  <pre><code>$(document).keydown(function(e) {
    if (e.keyCode == 27) {
          window.location.href = document.URL;
    }
  });
  </code></pre>
  
  <p>This code works perfectly:</p>
  
  <pre><code>$('.my-button-class').click(function(){
      window.location.href = document.URL;
  });
  </code></pre>