Rella
Rella

Reputation: 66935

How to make WebKit or IE call your application (.NET) from HTML page opened in browser?

I have a .NET application running on windows. I want clicking on some page element (button link flash app etc) to launch my app with some special parameters. (It should run not just in IE but on WebKit based windows browsers too) During App install we suppose that user is Admin and is running Vista or Windows 7 or Later.

So my question is - Where to get examples of such interaction (WITH source of course)?

So how to make WebKit based Browser or IE call your .Net application?

Upvotes: 7

Views: 3002

Answers (5)

John Saunders
John Saunders

Reputation: 161773

Given that the application to be run, and the browser, are both running on Windows, a registered protocol handler is the best way to go, assuming all interesting browsers support it. Considering that the link above is from the MSDN documentation on Internet Explorer Development, I can imagine that some browsers might not want to support this mechanism.

Upvotes: 0

Andy E
Andy E

Reputation: 344547

Register a custom URL Protocol Handler. Then you can specify the url using links, etc:

<a href="myapp://doSomething/>Click to run my app!</a>


I can confirm that this works in all versions of Internet Explorer. I've also tested it in the latest versions of Firefox (3.6) and Chrome (whose version escapes me). Chrome will not allow you to enter a custom protocol into the address bar, but it will launch applications from links using custom protocols.

If you have Adobe Reader installed, the acrobat:// protocol is registered. Unfortunately, SO doesn't allow links using custom protocols, so I can't add an example here I'm afraid.

Upvotes: 11

Max Shawabkeh
Max Shawabkeh

Reputation: 38603

You can register a protocol handler that points to your application, then have a link pointing to a URL with that protocol and whatever parameters you need.

Upvotes: 0

zneak
zneak

Reputation: 138041

You can't have a Webkit-based browser to open an application directly. Your best hope (and what Apple does to open the iTunes Store) would be to have your .NET application register for opening certain types of URLs, use a link that points to an URL of this type.

For instance, if your application can open myapp:// URLs, you could use the following HTTP header:

Location: myapp://mysettings

or a more conventional link:

<a href="myapp://mysettings">Foo</a>

And then the browser will take care to open an application that can handle the myapp:// URL scheme (in this case, your application).

Upvotes: 3

spender
spender

Reputation: 120420

I'd suggest that the only way to do this is by roundtripping to the server. The webpage triggers something on the server. The app is also connected to the server. I think it's probably unreasonable to do it any other way. If you want to get really dirty, it's possible to use Flash's LocalConnection (which uses a memory mapped file for communication) to chat to a .net app. Darron Schall has managed it (but is not sharing).

If it requires an app, why bother with a web page?

Upvotes: 0

Related Questions