how to attach window.close to cntrl+w keypress event in a xul window?
- by Erik Vold
I have a XUL window, and I want the cntrl+w hotkey to close the window, but when I attach:
window.addEventListener("keypress", function(ev) {
GM_log("onkeypress handler: \n"
+ "keyCode property: " + ev.keyCode + "\n"
+ "which property: " + ev.which + "\n"
+ "charCode property: " + ev.charCode + "\n"
+ "Character Key Pressed: "
+ String.fromCharCode(ev.charCode) + "\n");
}, true);
to the page, it treats pressing 'w' and 'cntrl+w' the same, charCode 119.. how can I determine that cntrl+w was pressed so that I may window.close() ?