We have a desktop application. We also have a web application.

We need the two to interact with each other. So when a button is pushed in the web application, the desktop application needs to start running a process (pulling data from the cloud using an API we've created). With two local applications, this can be done with ports/listening, editing a flag somewhere locally, and the other application reading this flag, etc.

Can this be done from web -> desktop?

Ideally the web application would have direct communication with the desktop application and notify it to begin pulling data down from the cloud using our API. But if this is not possible, having the desktop app run a process that loops and checks for a flag in a file or something would be a good start.

After minimal research, I've found some stuff like HTML5 File Api which interacts with "Sandbox" directory on the local machine. I've also read that it is impossible to access any thing on the local machine for security reasons.

Also, I dont want the user to be prompted to request a download file everytime, we need things to happen behind the scenes. (Even if the user has to initally set up some lower security / permissions just for this situation)

Any input is appreciated!

  • Can you clarify the locations/access of the web app and desktop application? Do you want a person to click on something in the web application in a browser of theirs, then activate some action in a desktop application that they themselves are running? Is there a certain acceptable delay - does it need to be as close to instant between click and desktop app action as possible? We can correctly assume you have control of both the web app and desktop app programming?
    – BrianH
    Aug 14, 2014 at 19:26
  • 2
    A "web application" is usually defined as something that runs in a browser anywhere in the world, and not on the same machine as the back-end. If that's what you mean, there is no way of influencing a locally running program directly from the web app without having the program actively listen for it, which effectively turns the system into a normal client-server set-up. Aug 14, 2014 at 19:36
  • The web app / database are hosted in Azure. The desktop application is opened on the computer the user is currently on, a windows machine. My other programmer sent me this neudesic.com/webinar/25461638 which is what im going to look into next
    – kevin
    Aug 14, 2014 at 20:07
  • That's a very bad idea. Anyone can attack you if you implement that. Aug 15, 2014 at 6:51

3 Answers 3


Generally speaking, its a good thing that web pages cannot interact with your operating system. You wouldn't want any random site to be able to access your files and programs.

If you need to work around this, a couple of options come to mind. Each will require some effort.

  1. turn your web application into a desktop application using a tool/framework such as node-webkit. Then you'll have access to the same local resources a desktop application would have.

  2. Host the web application inside a desktop application with an embedded browser. Extend the javascript system to allow the web application to intereact with the host application.

  3. Have the/a desktop app act as a web server, listening on port 80. Then within the web application, make calls to localhost:80.

  4. Create an ActiveX that runs inside the web application that will handle the link.

  5. Create a desktop version of your web application

  • 3
    6. Have your desktop app talk to your web server directly (perhaps open a port) Aug 14, 2014 at 19:43
  • 1
    7. Have both the web and desktop applications "talk" with each other using web sockets using the server as coordinator/middleman. Modern browsers are able to hold these with minimal effort and I'm sure desktop has libraries to support this too. If you are using .NET (maybe even Java) in your desktop look into SignalR, which is easy to integrate with most JS-based systems.
    – AnotherGuy
    Mar 5, 2019 at 20:31

I would begin by transitioning your data access to a protected service layer. If both the web application and desktop application are modified to pull from the same exact data source then it becomes trivial to establish a sort of "polling" of the service to determine if the action has been engaged and new work needs to begin.

Alternatively, you could retool your desktop application into a windows service that continuously watches either your data store or possibly use a filesystemwatcher to detect changes. If the web application has access to make changes to a file, then the service simply needs to watch for changes in that file to begin its actions.

Even beyond that, you could extend your windows service to accept snmp calls. Basically you would be building your own "server" that would be able to receive simple remote requests from your webserver. In essence, it would be a direct communication between web application and desktop application. I will agree here with @GrandmasterB that this is fairly dangerous if you are unfamiliar with this option as this creates a very dangerous intrusion vector on a public system. The connection will need to be secured to a specific port that is monitored and disallowed for all but the relevant systems, and it would be highly recommended to add some kind of encrypted authentication mechanism to it.

My preference, though, would be to make it a service based polling mechanism. It is easier to maintain, chews up fewer resources on either system, provides fewer intrusion vectors and is very scalable should your desktop application be rebuilt or rewritten for some reason.


Another solution is to have a link with custom URI scheme, such as subl://open. So you put following on the web:

<a href="my-app://action?param1=true&amp;param2=100">Open My App</a>

Then when user click the link, operating system will launch the corresponding local program. Registration of a custom URI scheme is OS dependent; for Windows, see the official documentation and question How do I register a custom URL protocol in Windows?.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.