I've got a script which is called by a keypress event, something like this:

<script type="text/javascript">
function respondToKey(e) {
  keyPressed = String.fromCharCode(e.which);
  if(keyPressed == 'g'){
    alert('you pressed the g key');

<body onkeypress="respondToKey(event)">
hit the g key to open a google window
when you hit the right key, the alert appears, but the window.open() never happens. There's not even a message in the Error Console, just nothing.

Is this a security feature? Any way I can get around it?

Using Firefox, by the way.