anakin59490
anakin59490

Reputation: 672

Launch local exe from webapp

I developed a web application hosted on a Linux server (or Windows for some clients). I use Angular 6 for the frontend and Spring Boot for the Backend.

So each user uses Firefox to connect to the app. So far so good.

However, I have to develop a new feature that allows the user to open a software installed on his own computer (Windows) from my web app ...

So I have to do this on the client side of my app (Angular or Javascript pure) to launch the software.

I know this is forbidden for security reasons except perhaps if we add an exception in the security of FireFox.

I tried the following code, isolated in a javascript file:

function launchDict(nom) {
  require(['child_process'], function (child_process) {
    //fs and child_process are now loaded
    var exec = child_process.exec;

    exec('C:\\PuTTY\\putty.exe', function (error, stdOut, stdErr) {
      alert("Appel logiciel");
    });
  })
}

How to do that?

****** Update ****** It seems like javascript way is a "bad way" because of security compliance. And solutions described seem to work only on IE example : Is it possible to run an .exe or .bat file on 'onclick' in HTML

Upvotes: 1

Views: 1339

Answers (1)

Paul LeBlond
Paul LeBlond

Reputation: 71

I don't believe it's possible due to the security risks, but as a workaround you could create a downloadable shortcut file with the parameters already inside it. It is an additional step for the user to click on the downloaded .lnk, but since it appears you already know the path to the executable on their local machine it should at least work.

Upvotes: 2

Related Questions