2

I know that you can launch an application by a browser with the following line of code but it displays the application as a new window. What I am looking for is how do you get an application to display within the browser window? It doesn't have to be Notepad. Any application will work fine because right now I am just working on a proof of concept. I will probably end up writing a small c# application to do what I need to. Any information is helpful.

Here is the code I have:

<a href="c:\windows\Notepad.exe" 
type="application/octet-stream">Launch Notepad</a> 

Edit:

Lets say it can only launch outside of the browser is there a way to pass information to a application? Any information would be helpful. Thanks.

JoBaxter
  • 710
  • 2
  • 12
  • 23
  • Didn't know that was possible so I gave it a google. Found this that shows how to display a winform within a browser window using wpf or something. - http://www.codeproject.com/Articles/31429/Embedding-a-NET-WinForms-Application-in-an-Interne – Neil Smith Apr 02 '14 at 19:18
  • That's not the same as launching an application from the browser. WPF is just another view of the same application, but that is a step in the right direction for your own applications. You can't run other apps though that aren't configured this way. – Sunny Patel Apr 02 '14 at 19:20
  • possible duplicate of [Launch application from a browser](http://stackoverflow.com/questions/3057576/launch-application-from-a-browser) – Sunny Patel Apr 02 '14 at 19:33

1 Answers1

3

You can't – at least not with an arbitrary application. An application has to be specifically written as a web browser plugin to enable a webpage to display the application's UI inside the browser.

Traditionally, this was done through NPAPI or ActiveX. ActiveX is IE-only, and NPAPI support is in the process of being removed from Chrome.

In short, this is not a road you want to go down.

Browsers are built to display web pages, so if you want to display UI in a browser, write it with web technologies.

If you have some kind of specialized need where users will have your software installed on their machine, an approach I've used successfully in the past is to have that app run a small HTTP server on a specific, non-standard port. Your web app (accessed normally via your web server) can then make CORS AJAX requests to the local sofware. (IE, http:​//localhost:12345/privileged-action).


If you just want to launch your app in its own window, you should register a custom protocol handler. You can then add a regular link in a web page that invokes your app and passes arguments.

<a href="myapp:foobar">Open MyApp</a>

If you registered your app as the handler for the myapp protocol, it would run it with the URL as the argument.

C:\path\to\app.exe "myapp:foobar"
josh3736
  • 139,160
  • 33
  • 216
  • 263