2

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mickey Shine
  • 12,187
  • 25
  • 96
  • 148
  • 1
    Why don't you write a custom client app for this. You are essentially modifying the browser and adding a non-standard functionality to it (and potentially introducing serious security vulnerabilities). You'll have to modify the client machine nevertheless. A rich client app would do it perfectly. – Mehrdad Afshari Nov 22 '10 at 04:02
  • I want my apps run like a web page: content are from server, easy to update and clients don't care anything. If my apps are native, I am afraid it won't be easy to achieve these goals – Mickey Shine Nov 22 '10 at 04:06

2 Answers2

2

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Gabe
  • 84,912
  • 12
  • 139
  • 238
0

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.

7wp
  • 12,505
  • 20
  • 77
  • 103