2

These are my requirements

  1. How to open an pdf file which is located in my local machine using html page?
  2. How to execute an exe file which is loacted in my local machine using a website?
    This is like what github does when we do clone in windows option. I need to implement exact same operation . I have a button and when I click that it need to run an application.This is the window while trying to clone in windows from github

Thanks in advance.

Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443
kbvishnu
  • 14,760
  • 19
  • 71
  • 101
  • 2
    Don't you think it might be a bit of security issue if a website could start any program on your machine? – fero Oct 05 '12 at 07:13
  • Yes there is a security issue . But How github is opening the file. In my case it is just like adobe files residing in the local folder – kbvishnu Oct 05 '12 at 07:14
  • 1
    I don't have github for Windows installed (I use Tortoise), but from your screenshot, I guess github registered its own URL scheme `github-windows:` (like Outlook registers `mailto:`) and redirects to a link with this scheme, so github will be started. But since the Adobe Reader hasn't registered something like `pdf:`, I don't think that this is possible. Furthermore, even if Adobe Reader did this, you can never be sure that the user doesn't have some other PDF reader. – fero Oct 05 '12 at 07:22
  • So you are saying that we need to register some URL Scheme like `myapp-pdf:`. While Installing the client app in machine ? – kbvishnu Oct 05 '12 at 07:30
  • Yes, I wrote an answer for it. :-) – fero Oct 05 '12 at 07:42

3 Answers3

1

You installed GitHub for Windows on your computer. And this installation registered the protocol github-windows: with the GitHub for Windows executable as handler. Nothing special going on here.

Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443
1

The only chance I see is to register your own URL scheme (as you said myapp-pdf: or something like it).

Then you can redirect (or open a new window) to a URL with your custom scheme and the browser should start your application giving you the URL as a command line parameter.

fero
  • 6,050
  • 1
  • 33
  • 56
0

Create custom Url Schema and Map to the application

I just explain some thing I got after your inputs. As all guys mentioned above, I need to generate a url schema for my application I need to register the schema and application path to be executed in Windows registry. This need to handle during the installation .

http://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx This link will show how to add the particular schema in windows registry and we can specify the application to be executed like mailto: for Outlook.

Thanks for SO to provide the details from here. how do I create my own URL protocol? (e.g. so://...)

Pros

Need to check about the security issues which may occur if we are using this approach.

Community
  • 1
  • 1
kbvishnu
  • 14,760
  • 19
  • 71
  • 101