title: javascript enter key redirection in text box
body: <p>I have a simple text box, and I wish to make the page redirected when I type something in it.</p>
  
  <pre><code>&lt;input type="text" onkeydown="window.open('http://www.example.com', '_self');" /&gt;
  </code></pre>
  
  <p>However when I press <code>Enter</code> key in this textbox, it does not go to the new page. But it does when I press keys like A, B, 1, 2... This happens in Chrome, Firefox and IE9 for me, not in IE8.</p>
  
  <p>But when I place an <code>alert</code> function in it, yet <code>Enter</code> key pressed, after I dismiss the alert box, it redirects successfully.</p>
  
  <pre><code>&lt;input type="text" onkeydown="alert();window.open('http://www.example.com', '_self');" /&gt;
  </code></pre>
  
  <p>It does in all browsers.</p>
  
  <p>Can anyone explain this browser behavior?</p>