Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

USB Barcode scanner opens browser's downloads page

I'm trying to scan some barcode to textfield contained in my browser but it opens the downloads page in any browser (chrome, firefox, ie). I'm guessing that there is some input equivalent to CTRL + J that triggers the browser to open the download page.

Is anyone ran into this problem? Is there a way to pass it (assuming that I my clients can't change their scanner configuration neither the browser configuration)?

Thanks.

like image 489
yanivsh Avatar asked Jan 15 '15 09:01

yanivsh


People also ask

Can a barcode open a website?

The barcode needs to contain the full address of the web address including 'http://'; or 'https://';. Example 'https://www.google.com/';. Address in the barcode is not to be preceded or followed by any other character, including the double quote symbol which the scanner will add automatically.

How do I use a USB barcode scanner?

First plug the USB barcode scanner to the female USB connector of an OTG adapter or a cable. Then plug the the micro-USB end of the OTG adapter or cable into the micro-USB port of your mobile device and wait for the system to recognize the scanner.

What app do I download to scan barcodes?

QR code scanner, barcode scanner app is also QR code generator in your pocket. Using QR generator is extremely easy to use, simply enter the data you wish on QR code and click to generate QR codes. QR codes are everywhere! Install qrcode reader app to scan QR code or to scan barcode on the go.

How do I scan a barcode to open a file?

To open files when a barcode is scanned, you have to use the start command for Windows and the open command for macOS, followed by the file path. This way the files will be opened using the default program associated with the corresponding file extension.


1 Answers

Although it is late to post an answer, I hope this helps someone in future.

The problem is due to the end character sent from the barcode reader. The default setting of my barcode reader is to send CR+LF after input. This unfortunately opens downloads page in chrome. The fix for this is very simple, instead of configuring the scanner itself (which can be tricky), you can add the following script to your page to ignore the end character sent from barcode scanner:

<script>
  document.addEventListener('keydown', function(event) {
    if( event.keyCode == 13 || event.keyCode == 17 || event.keyCode == 74 )
      event.preventDefault();
  });
</script>

There was also an old bug opened for this with chrome, but this was closed/unresolved since this is not a bug but more of an input configuration issue.

like image 127
Mustafa sabir Avatar answered Oct 31 '22 22:10

Mustafa sabir