This is because, as soon as you press enter in the omnibox, focus moves to the page. If you tried to do the same with onkeydown , omnibox will not change anything, because, as you said, this is not part of the document. One way to filter out the omnibox false event is to verify that each keyup has a pair of keystrokes.
<script> var down = false; document.addEventListener('keydown', function (){ down = true; }, false); document.addEventListener('keyup', function (){ if(down === true){ alert('It was from the page!'); } else{ alert('Omnibox. Ignore it.'); } down = false; }, false); </script>
Demo version
Create your own HTML page and try it because PasteHTML.com embeds it in an iframe. To make it work correctly, first click on the text to get the iframe focus.
Demo Remember to use the mouse to focus on omnibox and enter, not a keyboard shortcut. (This fires the onkeydown event, creating a false positive)
Update:. As for Chrome 35, this is no longer happening. However, I do not know which version they fixed.
Some guy
source share