Click here to Skip to main content
14,690,522 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
How to run an application on clinet side by clicking button on web page Using javascript or code behind c# code?
Posted
Comments
Denis Shemenko 2-Jul-13 6:11am
   
As i know, you cannot tell User's browser to execute some application, so this is impossible.
Maybe im wrong :)

You have to register a custom protocol/URL on the client first (see e.g. http://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx[^]).
Then you add some link like <a href="bernie://someArgument">click here to open my app</a> in the page.
When the user clicks that link, Windows looks into the registry how to handle that link. In your case, it would start a locally installed application with the parameters given in the link.
I do not know the details, but that's the way to go.
   
The former VBScript, JavaScript methods that enabled one to start client side applications are banned for security reasons.

Custom protocol handler can be one approach as Bernhard Hiller suggested. Still it can be a security leak, since it is global and can not be restricted to a single web application.
You can use Silverlight (http://msdn.microsoft.com/en-us/library/gg192793(v=vs.95).aspx[^]) and probably Java FX and Flex also to create "applets", with full trust, and capable of starting local application.

But all approaches need client action, probably an installation with elevated rights.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900