I use this already in a system that uses a magnetic card reader to
scan various magnetic cards into the system using jQuery and ajax
communications with the server. Alongside some python code to parse
the incoming data using some regex magic to place the data into
variables. So it *can* be done.

This is the jQuery library I used.
http://garetjax.info/articles/2010/01/magnetic-card-jquery/

The basic concept is, a card reader usually types faster than a human
can. Using the card readers start and end sentinels you can
successfully detect a card read if you subscribe to the char_event of
an element (in jquery case, the window object, this way you don't have
to worry about focus).

Barcode readers and magnetic card readers use the same technology.
They basically act as a keyboard to the system, they just type faster
than we ever could =)

--
Thadeus





On Wed, Aug 25, 2010 at 7:48 PM, Kevin <extemporalgen...@gmail.com> wrote:
> uch a case (assuming the browser window has focus), you can just
> read key events on the document object in javascript -- after a
> hardcoded input length has been read, or a timeout of say 1 second
> since the last 'keypress', you submit an ajax event.  However,
> distinguishing between the barcode reader and a *real* keyboard is
> something you have to watch out for.  On the other hand, you can
> intentionally not distinguish between *real* and barcode-reader
> 'keyboards', and transparently handle manually typed barcodes when it
> won't scan.
>
> The simplest solution is just to make a regular text input that you
> give focus to when the page loads so that the user can see the value
> that's being scanned.
>

Reply via email to