Milind
Milind

Reputation: 493

Create a listening socket on a web page

Is it possible to create a listening socket on a HTML page. I want to connect to the socket with a local application to get information about the web page like the location of the button etc.

Upvotes: 0

Views: 561

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 597971

Is it possible to create a listening socket on a HTML page.

Not in pure HTML or JavaScript, no. You would have to create a plugin that runs in the HTML page (ActiveX control, Java applet, Flash, etc) and have that plugin create a listening socket for outside apps to connect to. And this is assuming the browser even lets the HTML page host such a plugin in the first place.

The alternative is to have the application instead create the listening socket, and then have the HTML page use the HTML5 WebSocket API to connect to the application, rather than the other way around.

I want to connect to the socket with a local application to get information about the web page like the location of the button etc

Once you have established a socket connection (regardless of who connected to whom), either party can send packets to the other party, as it is a bidirectional connection. So the application can send commands to the HTML page, which can then reply back to the application as needed.

Upvotes: 1

Related Questions