can you do:

```javascript
if (typeof event.which !== 'undefined') {
  return event.which;
} else if (typeof event.charCode !== 'undefined') {
  return event.charCode;
}

return event.keyCode;
```