Is that possible to provide javascript API to cont

2019-08-15 06:07发布

I have a computer running windows and connected with many devices, such as printer, RFID reader, etc. I want all my apps run as HTML, CSS, 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 IE or Firefox), or what work are needed to make this possible.

Thanks

2条回答
beautiful°
2楼-- · 2019-08-15 06:46

Another possibility is to write a browser plug-in that would act as a helper. I believe browser plug-ins, such as ones for Firefox, have more free reign access to your physical machine. It could accept commands from your website to be executed outside of the browser's JavaScript sandbox. Also I believe you can write browser plug-ins for Firefox in JavaScript.

查看更多
叛逆
3楼-- · 2019-08-15 07:07

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

查看更多
登录 后发表回答