The core of the issue is that FireFox triggers the keyPress event on all keys, but all other browsers only trigger it for keys that produce a character value. Thankfully, FireFox also provides us with enough detail to detect if the keyPress event has been triggered by a key with a character value or by another key.
The following tables shows the values for event.keyCode, event.which and event.charCode (it is worth noting that all three of these values are now deprecated and <a href="https://w3c.github.io/uievents/#widl-KeyboardEvent-key" target="_blank">event.key</a> should be used instead; although browser support is currently limited as the standard is a working-draft) returned from each browser. The first value in each cell is the value for the apostrophe key, the second value is for the right arrow key (both can return a value of 39, so it makes a good example for this post). Values with a hypen (-) mean that the event was not triggered.
|Chrome||39 / -||39 / -||39 / -|
|FireFox||0 / 39||39 / 0||39 / 0|
|Safari||39 / -||39 / -||39 / -|
|Internet Explorer||39 / -||39 / -||39 / -|
|Opera||39 / -||39 / -||39 / -|
Armed with this information the key detection is relatively simple. In the keyPress event I get the value for event.which. If the value is zero (0) then I return from the function. If the value is non-zero then I continue the function and action the event.