2

To begin with, this isn't about keeping users out of page source, as in this seven-year-old question. It's about keeping browser definitions of F1-F12 (both shifted and unshifted) from interfering with a browser-based terminal emulation.

Clearly, it can be done, because the IceCap 5250 emulator/screenscraper (demo here; if a sign-on screen is presented, use "demo" for both user and password) does it, and even prevents Chrome from acting on F12, but it's evidently not easy, because the "hotkeys" JavaScript library fails to keep Firefox from responding to F7 with some dialog about "caret browsing," and fails to keep Chrome from throwing up the Developer Tools sidebar in response to F12.

Can anybody here shed any light on this?

1 Answers1

1

This JS library catches the F12 key in Chrome without opening DevTools and captures the F7 event in Firefox. It doesn't stop the caret browsing question from popping up, but it does trigger a JS event that you can attach to. There may not be a way to stop FF from putting the popup up, but it still triggered the JS event regardless.

http://www.openjs.com/scripts/events/keyboard_shortcuts/

I found the library from this question: Handling key-press events (F1-F12) using JavaScript and jQuery, cross-browser

HBlackorby
  • 1,308
  • 1
  • 11
  • 18
  • A note that FF considers the caret-browsing note part of its accessibility features, and I have not found any way to disable the warning. They may deliberately not allow you to turn it off, as it's part of their accessibility suite. – HBlackorby Jan 21 '20 at 19:26