1

We have a POS (Point Of Sale) computer that is splitted in 2 sections: On the left side is a small browser where my javascript web application is running. on the right side there is the POS software.

My question: Is there any possiblity to catch the handheld scanner input when the browser and the web app is not focused?

Because the cashier is focused the most time on the POS software typing on buttons etc.

The goal is to catch the scan input (in this case an item EAN code), in the web app and show the corresponding image of that product.

I have tried to read out the scanner input but it can only work when the app is somehow focused.

Any help is welcome

Thanks

Leon
  • 443
  • 5
  • 19
  • 2
    If I understand it correctly, usually these scanners work by sending keystrokes. So basically you're asking if you can capture keystrokes in browser-based JavaScript when the browser (and your page within it) isn't focused. The answer to that is no, you can't. You'll need something running outside the browser's protected environment to capture keystrokes. – T.J. Crowder Nov 26 '21 at 13:04
  • 1
    But if the scanner offers a configuration option where it shows up as its own USB device instead, in some browsers (Chrome, certainly) you might be able to use the [Web USB API](https://wicg.github.io/webusb/). But that's a big "if." :-) – T.J. Crowder Nov 26 '21 at 13:06
  • 1
    @T.J.Crowder Thanks for the hint, i already thought that it would not be possible to do that. I will contact the POS Software company, maybe they are able to send the scanned text somehow to the web app. – Leon Nov 26 '21 at 13:08

0 Answers0