10

I'm trying to use a webpage as an entry point for a kiosk. The HTML will be run in local, I need two things:

<a href="c:\Users\Admin\Documents">...

Which works like a charm

And..

<a href="c:\Program Files\Windows Live\Mail\wlmail.exe">...

(program just an example, all programs are the same)

Which works but.. it prompts to download the file then you are prompted to start it.. Is there any way to do this directly, like click and bam you opened notepad.exe? Maybe using a Java applet?

EDIT:

I know it can't be done remotely, I'm talking about local files. The file will be accessed as c:\myhtml.html And will open ONLY already installed files, nothing from the web.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
0plus1
  • 4,475
  • 12
  • 47
  • 89
  • I had to do this once and used a canonical verb. No muss, no fuss. – Gayot Fow Apr 04 '14 at 18:00
  • Does this answer your question? [How to launch an application from a browser?](https://stackoverflow.com/questions/3057576/how-to-launch-an-application-from-a-browser) – bad_coder Jan 10 '22 at 12:24

4 Answers4

11

If i get your question right , the closest thing to get what you want would be using *.hta which is a HTML Application that runs outside the browser window just like a normal app.

<script type="text/javascript" language="javascript">
    function RunFile() {
    WshShell = new ActiveXObject("WScript.Shell");
    WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
    }
</script>

Bit more info here: http://www.kunal-chowdhury.com/2010/09/how-to-execute-local-file-using-html.html

oprimus001
  • 126
  • 1
  • 3
3

The right way to implement this is by creating custom protocol in Windows. Details in the MSDN article "Registering an Application to a URI Scheme"

Vadim Rapp
  • 33
  • 5
1

No, this is security issue, browsers don't allow it because it could be security risk to run apps without prompt, just by clicking on the link.

There are several technologies like java WebStart and ASP ClickOnce - they will install the app more or less automatically, signing the application helps too - the messages the user gets look less scary.

Roman Goyenko
  • 6,965
  • 5
  • 48
  • 81
1

Correct me if I didn't understand you. If you're running the web page locally (http:\127.0.0.1) and want to execute a program in the same machine, it will depend on the technology that you're using, for example in php you could use exec() to execute a program on user input but it will run on the server side.