是否可以提供JavaScript API来控制USB,LPT和COM设备? [英] Is that possible to provide a JavaScript API to control USB, LPT, and COM devices?

查看:65
本文介绍了是否可以提供JavaScript API来控制USB,LPT和COM设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台运行Windows的计算机,并且与许多设备相连,例如打印机,RFID阅读器等。

I have a computer running Windows and connected with many devices, such as a printer, an RFID reader, etc.

我希望我所有的应用程序都可以HTML,CSS和JavaScript运行,因此我需要通过JavaScript访问这些设备。但是我不知道是否可以向浏览器(例如Internet Explorer或Firefox)添加自定义JavaScript API,或者需要做些什么才能使之成为可能。

I want all my applications run as HTML, CSS, and JavaScript, so I need to access these devices through JavaScript. But I don't know if it is possible to add custom JavaScript API to browser (such as Internet Explorer or Firefox), or what work are needed to make this possible.

推荐答案

您可以使用浏览器的基本打印功能来控制打印机,并且可以找到键盘楔 RFID 读取器,这两种读取器都允许您仅使用基本的JavaScript代码来操作它们。但是,您极有可能需要 ActiveX 控件( COM 组件),您可以从浏览器脚本中进行实例化,从而对设备进行任何真正的控制。

You can use a browser's basic printing abilities to control a printer and may be able to find a keyboard wedge RFID reader, both of which would allow you to use just basic JavaScript code to operate them. However, you more than likely will need an ActiveX control (COM component) that you can instantiate from a browser script to be able to have any real control over the devices.

不幸的是,您可能必须自己编写这些控件。您可以 能够通过C#明智地使用 P /调用,但是。

Unfortunately, you may have to write those controls yourself. You might be able to do it in C# with some judicious use of P/Invoke, however.

这篇关于是否可以提供JavaScript API来控制USB,LPT和COM设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆