如何从浏览器访问客户端 PC 上的设备
从浏览器访问客户端 PC 上的设备(条形码读取器、扫描仪等)有哪些不同的方法?我意识到我的用户可能需要一个插件。这些设备可能有特定于其设备的 API;如果可用的话,我想利用他们的 API(也许是 Java,也许是 C,也许是命令行)。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
签名 Java 小程序可以对大多数内容进行独立于平台的访问。用户必须安装 Java,并且必须允许签名的小程序运行。
如果您为 NSAPI 编写插件,一旦安装完毕,您将拥有访问用户可以访问的几乎所有内容。当然,他们必须安装插件。
Flash 提供了相当多的设备访问。
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.
这不是一件小事,并且没有标准化的 API(除了可能仅限于 Internet Explorer 的 JScript/ActiveX 领域)。
要通过 TWAIN 界面访问扫描仪,请查看此问题< /strong> 对于我所知道的所有普遍可用的选项。
大多数其他事情将取决于自定义编程的 Active-X 和其他插件。我看过 SO 上讨论的商业条形码扫描仪插件,但现在找不到问题。
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.
许多条形码阅读器可以插入键盘和 PC 之间,因此扫描的条形码会直接进入键盘缓冲区。其他设备要么插入串行端口,要么具有模拟串行端口的驱动程序。以下 python 代码会将数据从真实或虚拟 COM 端口复制到活动窗口的键盘缓冲区。 COM 端口号是硬编码的,但可以轻松更改。
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.
根据您想要做什么,Silverlight 和 Adobe 在这个领域都具有一些有限的功能。网络摄像头、Silverlight 4.0 中的打印等。然而,这并不简单。 Silverlight 4.0和Flash都支持条码扫描。
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.