1

Is it possible to launch client side desktop applications like Adobe Reader,any game or any other soft-wares from web?

I have got one link How to launch an EXE from Web page (asp.net)

where one of them have given way to open a notepad(desktop application)using java script,which is limited to IE.

In similar way I want to create such links on my web page so that if user clicks on that links like

e.g if user clicks on link "Adobe Reader" then Adobe application should get open/launch.

Is there any way to open any desktop applications from web?

I have came across signed applet concept, where we will call signed applet from web page i.e using tag , & inside

applet we will call desktop applications.

By using applet way ,I have created a signed applet, & I am able to open notepad application by providing directly path like this in applet:

Process process = new ProcessBuilder("C:\\Windows\\notepad.exe").start();

But how can I do this in generic way, means notepad application or any other softwares can be installed on anywhere in the system.

So we will not have idea about application's installed path, so is there any way by using which we can start them as a service by providing service name like this??

Process process = new ProcessBuilder("notepad.exe").start();
Community
  • 1
  • 1
Java
  • 2,451
  • 10
  • 48
  • 85
  • Why would I as an end user want to open desktop apps. from links on a web page? Doesn't that seem just a little ..insane, to you? Like the tail wagging the dog. – Andrew Thompson Oct 29 '14 at 00:47
  • Possible duplicate of [How to run an external program, e.g. notepad, using hyperlink?](https://stackoverflow.com/questions/2800081/how-to-run-an-external-program-e-g-notepad-using-hyperlink) – Felix D. Mar 13 '19 at 11:04

1 Answers1

3

I handle this by registering the target application as a protocol handler, either the target application itself, or a delegate app that's guaranteed to be installed on client machine.

then using a link in the form: myapp://someaction/arg0/arg1

then myapp://someaction/arg0/arg1 will be passed to your app as command line argument then you can parse and perform the appropriate action.

Here's an MSDN article on how to achieve that: http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx

So in your case, you can either:

  • Make a script/registry key that would register protocols for the target apps, and have clients download and install it. Then you can add can launch from the web page using e.g. myapp://reader/
  • Create one application (handler) and have clients install it, the handler then will then take the target application from the url e.g. myapp://reader/document or just myapp://reader to open "Adobe Reader" on client machine.

Second approach is especially useful if you want to perform more actions based on args specified in the url.

  • in my case desktop applications are already installed, I just need to launch them from web page link. – Java Oct 28 '14 at 10:16
  • Using this approach you'll need to register the app as a protocol handler in HKEY_CLASSES_ROOT on the client machine as per MSDN document above, and then add link to your web page with **myapp://anything** and the browser will open your application. – Mustapha Elmalah Oct 28 '14 at 11:13
  • If the application is yours, you can make it register itself – Mustapha Elmalah Oct 28 '14 at 11:17
  • Hey I am able to open notepad application by providing directly path like this: Process process = new ProcessBuilder("C:\\Windows\\notepad.exe").start(); – Java Oct 28 '14 at 12:36
  • But how can I do this in generic way, means notepad application or any other softwares can be installed on anywhere in the system. So we will not have idea about application's installed path, so is there any way bys using which we can start them in following way i.e by using service name. Process process = new ProcessBuilder("notepad.exe").start(); – Java Oct 28 '14 at 12:38
  • I do not think that is possible, if that would've been possible then one could simple make a web page that could manipulate the client machine with a button click. e.g. running malicious delete command to delete files on client machine through cmd.exe. Sorry that i have not stated that in my answer. – Mustapha Elmalah Oct 28 '14 at 13:50