Sometimes, you may want to launch your application when user clicks a link on your webpage. This is especially useful for gaming sites, starting the gamewhen the player joins a poker table etc. You can see this at work at http://allinplay.com.

Few months ago, I was into a project where I had to implement this feature. Since it was to work only in windows, I could use custom "url protocol" handlersupport.

For that I registered the application to be started as an url protocol with a custom url scheme for example "appname.webstart". Then launching the appwas just a matter of navigating to a url which uses the registered scheme for example "appname.webstart:arguments".

How it works: When your browser (both IE and firefox) is navigating to a url, it looks up the scheme in the registry and loads the attached handler. schemeslike http and ftp have default handlers implemented.What we do is create a new scheme and specify our application as the handler, after which all the requests for that scheme will be handled by our application.

How to launch: You can use javascript to redirect the browser the url likelocation.href = "appname.webstart:2998";Here "2998" is some type of argument for the app. Now the browser will start the app with the specifyed argument. The program should parse the commandlineargument and perform the action according to it.

Detail instructions about creating url protocol handlers and how to register them can be found at http://msdn2.microsoft.com/en-us/library/aa767914(VS.85).aspx.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList