javascriptcombrowserdevicelpt

Is that possible to provide a JavaScript API to control USB, LPT, and COM devices?


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

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.


Solution

  • 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.

    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.