3

I would to receive barcode string events in the browser when a barcode reader device is connected to the computer. I have got no idea about how this is possible. But im expecting an implementation like:

window.addEventListener('scanner', function(readerEvent){
  console.log(readerEvent
})
  • 1
    barcode scanners are traditionally handled as simple text input devices "keyboard". Some have a `prefix` that you can set that will assist software in identifying the input as coming from a scanner. – Steve0 Aug 29 '18 at 15:10

1 Answers1

1

A lot of barcode reader devices operate as a "keyboard wedge" - that is, when reading a barcode, they act as if someone was typing the equivalent text using a keyboard. Your program just uses the normal I/O operations used for obtaining input typed on a keyboard.

In the case of USB connected barcode readers, I imagine they comply with the USB HID profile.

RedGrittyBrick
  • 3,827
  • 1
  • 30
  • 51