Look at the scanner jack.

If it looks like this:

, then it’s a keyboard wedge scanner. It acts like a keyboard: just types your barcode into an edit field.

If it looks like this:

, it’s a serial port scanner.

You need to create an instance of System.IO.Ports.SerialPort and use it to communicate with the scanner.

If it looks like this:

, it’s a USB scanner. From programmer’s point of view, it can be either a keyboard wedge or a serial port scanner.


Ours was wedge scanner. If we want to intercept the barcode input , for instance for validation or some logic decision where to show the input , then you should catch the Ctrl+b event , initialize a flag saying you’re now reading the barcode . On each KeyPress you’ll hit , if it’s not “Enter” (the end of Barcode input) and the flag of  (Ctrl+b)  (Start Barcode Read) is true , add each time add the value to some parameter. When the “Enter” comes you have all the bar code data in the parameter. :


  1: var barcodeWorking = false;
  2: var barcode = "";
  4: //This function fired when ctrl+b insert : begin reading with barcode
  5: function FireEventB_KeyAndONE_Key()//Override the function of KeboardUse.js
  6:       {
  7:           barcodeWorking = true;
  8:           window.focus();//כדי שהברקוד לא יכתב לרכיב טקסט בדף
  9:       }
 11: function KeyPress(theKey)
 12:       {
 13:            var key=theKey.keyCode || theKey.which;
 14:            if(barcodeWorking)
 15:            {
 16:                if(key == ENTER_KEY)//'Enter' pressed : end of the barcode
 17:                {
 18:                     alert(barcode); )//לעשות מה שצריך עם הברקוד
 19:                     barcode = "";
 20:                     barcodeWorking = false;
 21:                }
 22:            else
 23:            {
 24:                 barcode += String.fromCharCode(key);
 25:            } 
 26:         }
 27:       }


Don’t forget to connect the KeyPress to Body tag.

   1:  <body language="javascript" onload="windows_onload();" oncontextmenu='return false' onkeypress="KeyPress(event)">


The idea has been generated by me.

The source code (implementation) has been written by Sharon Said.