Reading barcode from an external reader device in browser

Viewed 1111

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 Answers

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.

Related