Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use serial port in web environment

I need to use serial port in client side of web based application. which solution suggested for using serial port in web browser. can Firefox addon use serial port or call dll function? which other solution?

like image 541
Sajad Bahmani Avatar asked Aug 28 '11 15:08

Sajad Bahmani


2 Answers

You'll have to write add ons to make this work.

For Internet Explorer; you can write a Browser Helper Object(BHO).

For Firefox, Chrome, and Safari; I think your only option is to write a Netscape Plugin using NPAPI. FireBreath is a very useful framework for building these kinds of plugins as it takes care of a lot of the dirty work for you, allowing you to focus on the plugin itself. This will let you knock out those three with one stone - you can also write it to be cross platform (support many operating systems) if you desire. Each of those browsers have their own extension models as well that can be written in pure JavaScript; but they don't expose a serial port API due to lack of need and security concerns; making NPAPI the only viable solution.


However, all that said, I would question whether or not you should be doing this in a browser at all. This sounds more like a client application, to me.

You have a few other options depending on your needs. If you are writing specifically for the Windows platform, many have found that they can use Silverlight 4 Out-of-Browser plus an Active-X object for serial port access (Silverlight does not have a native API for serial port access). This won't work in the browser; but it's an option to consider.

like image 200
vcsjones Avatar answered Oct 13 '22 05:10

vcsjones


Consider a lightweight client application which implements the websocket protocol.

like image 38
Steven Lu Avatar answered Oct 13 '22 05:10

Steven Lu