Reconcile Firefox slash handling and key codes

doom66bizkit

New Member
I have a webpage where users should be able to type anywhere and have their input tracked. One problem is that the slash key, "/," in firefox is a shortcut for opening the search. This is undesirable for me. I have not found a way to trap the search functionality and still add the input to my tracking. I add the input to the stack on \[code\]keypress\[/code\].\[code\]keydown\[/code\]...\[code\]preventDefault\[/code\] works best in FireFox, but the problem is that in Chrome, \[code\]keypress\[/code\] does not fire for some reason (not sure why \[code\]preventDefault\[/code\] would stop that, but it does). This would be okay if I could add the slash on my own to the input stack..but Firefox is already adding it because \[code\]keypress\[/code\] is still triggered. \[code\]stopPropagation\[/code\] does not prevent \[code\]keypress\[/code\] from triggering in FireFox either. \[code\]$(document).keypress(e)\[/code\] in the \[code\]keydown\[/code\] method also does nothing.Another issue I have is that "backspace" is supposed to remove from the stack, but I add to the stack with \[code\]String.fromCharCode(e.which)\[/code\] and add the data to an \[code\]input type="text"\[/code\] field that the user can see. In Chrome this works perfectly, but in FireFox, it adds a character representing the backspace and then immediately removes it, preventing another character from being removed. Having "backspace" and "f5," etc. characters in the input is also undesirable. Is there a way to tell if the \[code\]fromCharCode\[/code\] value is valid for a text field? I think what's happening is that Chrome just does that automatically.EDIT: This may help, but FireFox apparently triggers \[code\]keypress\[/code\] before \[code\]keydown\[/code\] (Chrome does the opposite) on my webpage. This is unusual.
 
Top