views:

519

answers:

6

Is it possible to access hardware devices (web-cams, magnetic card readers, etc.) from within Internet explorer?

If yes, what technologies are used? And are there any .Net examples.

In my case, I need to access a magnetic card reader that would be attached to the client computer. The web-app would need to be able to access the reader and get the card information, which will then be used to access data-tables from a database running on the server.

I have seen web-cams that are integrated into websites, was wondering how that is done? Because if web-cams can be accessed, so should any other device attached to a USB port.

Finally, can SilverLight applications access hardware? Can they print to an attached printer?

A: 

Currently no way to give a Silverlight Application access to anything other than readonly access through the OpenFileDialog as already described, or to IsolatedStorage.

You could try writing activeX control that do that.

01
+4  A: 

Custom ActiveX control is probably your best bet

cbrulak
+1  A: 

If you need hardware access, then a web app is a poor choice. You're gonna have to install something client-side with sufficient privileges to access the device, so you're probably better off writing a full-blown client app that just talks to the server.

Yes, you could write a browser add-on that runs with full privileges and passes data to the page somehow. But you still have to make sure it is installed on every client machine, and now you have two very different codebases to maintain. Unless the add-on and/or the web app are useful in some way alone (the add-on acts as a general-purpose input driver or the app can still accept input without the use of the add-on), you're just going to end up making life more difficult for yourself and your users.

As gregmac mentions, you may not even actually need direct hardware access. Check that out first...

Shog9
+1  A: 

You can access webcams using flash. I've never used magnetic card readers, but most barcode readers simply show up as keyboards, and since it's a similar technology, it might be possible to configure the card reader this way as well.

I've written a web app before that uses a barcode reader, and you just simply scan it when you have focus on certain fields. Javascript helps with the handling, so it captures the Enter keypress sent at the end of data, etc.

I also had a box in the corner appear that said "Ready to scan" when the focus was on any fields that allowed scanning. In my case it was an inventory app, so it included quantity and item # fields.

A nice huge benefit here is it will work in browsers besides IE - which means the client-side part of your app will perform at least twice as fast (IE is by far the slowest of the mainstream browsers).

gregmac
A: 

Custom ActiveX is mentioned here and is a possibility for sure. If you need to have cross browser or cross platform support a Java applet might be a better bet.

laz
+1  A: 

You can try using a FullTrust WPF-Browser application, xbap. You need to use ssl certificates, but if these are installed on the client machines and on the server you can use the hardware from the browser.

When you host your xbap on your local machine, you don't need the certificates so you can test this. When testdeploying you can create the certificates from visual studio and install these on the server and let the users download and install those.

Another way to access hardware is to register an application to an URL protocol. And communicate with that. This way you can write HTML like

 <A href="MyScanReader://ReadTheScanNo?12345">Scan</A>

Let that application send the data to the server by calling an url. We used that once to launce applications from within the browser.

Sorskoot