Execute .exe from html

2

Good morning

How could I make a windows program run when I clicked on an image?

<img src="smiley.png" alt="Smiley face" height="42" width="42">

The images I put in this way to the html, and I want to click on that image to run, for example, the notepad.

I've been trying some things with javascript (windows.open) but I have not been able. Thanks

    
asked by xxsould 15.11.2017 в 12:55
source

2 answers

7

You can not for security reasons, no browser allows a web page to access system resources except in very specific cases (the only case I know is to choose a file to upload using a file type input).

The only scenario similar to what you want is that from a page you download a .txt file and the user runs the notebook instead of simply downloading it and saving it, but it is still the user's choice.

    
answered by 15.11.2017 / 13:13
source
5

You can try this script

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