How to read from serial port on web page

I want to create a web form so that the user fills in some fields. The value of one field must be read from the serial port (COM1) of the client computer to which the special equipment is connected, and the user presses the Send to PC hardware key when filling out the form.

How can I listen to the COM1 port on my web page and get the value of COM1 and automatically put it in the web form?

I heard that ActiveX controls can do this, but it is only compatible with IE (right?). Another option is Java applets.

I want a simple solution compatible with (at least) IE / Firefox / Opera.

I am on the server side, I may have ASP or PHP, but I appreciate it if you give a solution for everyone.

UPDATE:

We can tell customers to change their security settings to accept our ActiveX / applet.

We can also inform customers to install a user program that runs as a service and is read from the serial port.

The problem is that the read data must be entered into the web form automatically and immediately.

An explicit applet is a good idea, but the client needs to install a large JRE.

Is there any other option?

+5
source share
4 answers

With the Java applet, you can read from the serial port, but you need to sign the applet for security reasons. To firm unofficially (without the sun), you must create a certificate. Here is an example .

+3
source

I was solving the same problem and I did it. This is done using the Java Web applet. You will need NetBeans. Read "readme" first. Let me know if anything, pls.

http://racky.wz.cz/applet_rs232.zip

Designed for serial COM1. Connect an RS-232 cable and short (connect) terminals 2 and 3 on the other end to it.

+4
source

This seems to violate most security models for the Internet. I canโ€™t think of how it could be done in a browser without providing an applet or ActiveX control with a number of permissions (and even then Iโ€™m not sure if this is possible). I think that communication with the serial port may require some kind of proprietary โ€œthickโ€ client application.

+1
source

Java may well be your best bet to support cross-browser and cross-platform compatibility. A quick search has brought up these pages that may come in handy:

Server side choices do not matter. As soon as the client reads the data, it will be the same as sending any other data to the server side of the script.

0
source

Source: https://habr.com/ru/post/921451/


All Articles