Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to launch an application from a browser?

Is it possible to launch an application from a browser? I am not talking about opening a file from a browser (like open a PDF with Adobe Reader), but rather opening a new (blank) instance of an application that is installed on the user's machine.

Hypothetical situation: User browses a website that lists computers that can be managed via RDP. He clicks on a link to 192.168.1.10, that link opens Microsoft RDP client (mstsc.exe) with that ip address already filled out.

I am talking strictly about Windows universe.

Is that thing even doable outside of ActiveX and IE?

Is it wise to attempt this in IE with ActiveX?

like image 818
Goro Avatar asked Jun 16 '10 22:06

Goro


People also ask

How do I run an application in my browser?

If the basic idea is to launch a desktop app from the web browser, the first step is to create a new Registry in Windows and path a URL Custom protocol. And if you need it you can also send parameters by changing console arguments in your app and append the parameters in your html file. Show activity on this post.

Can you launch a exe from a browser?

So you really can't launch .exe files from a browser with any much success - it simply a security hole the size of open barn door. You might get some success opening up some trusted locations for the browser - but it is a difficult challenge at best.


2 Answers

The correct method is to register your custom URL Protocol in windows registry as follows:

[HKEY_CLASSES_ROOT\customurl] @="Description here" "URL Protocol"=""  [HKEY_CLASSES_ROOT\customurl\shell]  [HKEY_CLASSES_ROOT\customurl\shell\open]  [HKEY_CLASSES_ROOT\customurl\shell\open\command] @="\"C:\\Path To Your EXE\\ExeName.exe\" \"%1\"" 

Once the above keys and values are added, from the web page, just call "customurl:\\parameter1=xxx&parameter2=xxx" . You will receive the entire url as the argument in exe, which you need to process inside your exe. Change 'customurl' with the text of your choice.

like image 97
Abhijith C R Avatar answered Oct 11 '22 21:10

Abhijith C R


You can't really "launch an application" in the true sense. You can as you indicated ask the user to open a document (ie a PDF) and windows will attempt to use the default app for that file type. Many applications have a way to do this.

For example you can save RDP connections as a .rdp file. Putting a link on your site to something like this should allow the user to launch right into an RDP session:

<a href="MyServer1.rdp">Server 1</a> 
like image 39
brendan Avatar answered Oct 11 '22 21:10

brendan