How to access devices on a client PC from a browser
Asked Answered
B

4

5

What are the various ways to access devices on client PC - a barcode reader, a scanner, etc. - from a browser? I realize my users may need a plugin. These devices may have an API that is specific to their device; I would like to exploit their API if available (maybe Java, maybe C, maybe command line).

Baptiste answered 1/2, 2010 at 18:2 Comment(2)
Every barcode scanner I've ever seen works as a keyboard, so it will work everywhere a keyboard will with no extra setup.Picker
The devices are more similar to a scanner than to a barcode reader.Baptiste
D
5

A signed Java applet can have platform-independent access to most things. The user has to have Java installed, and has to allow the signed applet to run.

If you write a plug-in to the NSAPI, once they've installed it you'll have access to essentially anything the user can access. Of course, they have to install the plug-in.

Flash offers quite a lot of access to devices.

Duky answered 1/2, 2010 at 18:11 Comment(0)
P
1

This is not a trivial thing, and there is no standardized API for it (except maybe in the JScript/ActiveX area that is confined to Internet Explorer).

For accessing scanners through the TWAIN interface, check out this question for all generally available options I know of.

Most other things will be down to custom programmed Active-X and other plug-ins. I have seen commercial barcode scanner plug-ins discussed on SO, but can't find the question right now.

Privation answered 1/2, 2010 at 18:9 Comment(0)
M
1

Many barcode readers can be inserted between the keyboard and the PC, so the scanned barcodes go straight into the keyboard buffer. Other devices either plug into a serial port or have drivers that emulate a serial port. The following python code will copy data from a real or virtual COM port to the keyboard buffer of the active window. The COM port number is hard-coded but this can easily be changed.

import serial
import SendKeys

ser = serial.Serial(2)
print ser.portstr
while 1: # exit loop when ctrl/c pressed
    line = ""
    while 1:
        char = ser.read()
        if char == "\r": break
        line = line + char
    print line
    SendKeys.SendKeys(line, 0)
ser.close()
Mesopotamia answered 1/2, 2010 at 18:12 Comment(0)
R
0

Depending on what you are trying to do, Silverlight and Adobe both have some limited capability in this arena. WebCams, printing in Silverlight 4.0, etc. However, it is non-trivial. Silverlight 4.0 and Flash both support barcode scanning.

Reversion answered 1/2, 2010 at 18:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.