1

I used a SO answer in my page for saving text on Ctrl+S, but as I don't like just copy-pasting without understanding first, I decided to do so first. It's a simple jQuery script, which I converted (still working) to this:

/* A key is pressed */
$(window).keypress(function(event) {
  /* Ctrl + S or ?? */
  if ((event.which == 115 && event.ctrlKey) || (event.which == 19)) {
    savedata();
    event.preventDefault();
    }
  });

The bit I'm asking about is event.which == 19. A quick search on ASCII codes tells me it's "Device Control 3 (oft. XOFF)". However, the link of XOFF and google didn't bring much light to the subject. So,

Is the ASCII character 19 (Device Control 3) still used in some computers/keyboards/other devices or can I securely delete that bit?

Note: I want to delete it so I can change it to a switch and I don't have any hanging, not understood code.

Community
  • 1
  • 1
Francisco Presencia
  • 8,732
  • 6
  • 46
  • 90

1 Answers1

1

AFAIR which is key scancode, not an ASCII code. Anyway, code 19 should stand for some key like arrow or somewhat, which doesn't have printable representation like letter or digit. E.g. [Esc] has code 27.

http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes - looks correct.

kirilloid
  • 14,011
  • 6
  • 38
  • 52
  • Thanks, I visited that link but it wasn't until I looked down to the keyboard and saw "Pause Break" that I realized I have that key. However, it's not desirable that it saves the document when you press "Pause Break", I will change it accordingly. I'll wait to accept this just in case someone has more information (like, maybe that key is mapped to "save" in some keyboards). – Francisco Presencia Aug 10 '13 at 13:53
  • Ther're also media keys, like play/pause/etc. most of them have standard codes as well. – kirilloid Aug 10 '13 at 14:33