I want to open an exe file through a link in an HTML file.
Is it possible? If so, how?
I want to open an exe file through a link in an HTML file.
Is it possible? If so, how?
On a local computer you can do it with ease, So you have just to Create your own custom protocol, like the one used by Skype or iTunes to launch their native windows applications :
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\ACCapp]
@="URL:ACCapp Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\ACCapp\shell]
[HKEY_CLASSES_ROOT\ACCapp\shell\open]
[HKEY_CLASSES_ROOT\ACCapp\shell\open\command]
@="msaccess.exe"
the word in bold ACCapp is the name of the custom protocol that would be used on your html href link as follow
<a href="ACCapp://">PLEASE RUN MS Access exe file</a>
You can not start/execute an .exe file that resides locally on the users machine or through a site. The user must first download the exe file and then run the executable.
You can do this
it's the only way I see:
<html>
<head>
<title>Open exe</title>
<script type="text/javascript">
function runProgram()
{
var shell = new ActiveXObject("WScript.Shell");
var appITunes = "\"C:\\Program Files\\iTunes\\iTunes.exe\" ";
shell.Run(appITunes);
}
</script>
</head>
<body>
<a href="javascript:runProgram()">Run program</a>
</body>
</html>
Due security reasons it's not possible, and probably it's better it stays that way.
The following code works, but only on the machine which the program exists on:
<a href = "c:\Myfolder\Myprogram.exe">
I created an application for this exact purpose. It is called WebRun and you can download it from www.webrunapps.com. After installation you can create a webrun link to launch any executable / file / command on your Windows PC. Here is an example to run notepad:
<a href="webrun:C:\Windows\notepad.exe">Notepad</a>
Hope that helps.
You could write an Active-X object that runs in internet explorer only.
It's not an exe but it's the closest you'll get to running an exe.
I know a good answer to this one, Roblox and Atom uses this technique to run exe programs with a link. I have never done this so I can't really explain how to do it but I know how. They use URI protocols. URI protocols are like http, ftp, and https. I don't know Roblox's uri protocol, but I know Atoms, atom's is atom://. I recently just learned of this type of technology so I don't know much about it.
Except, the user must first download the exe files first, than once download, if the uri protocol is set on it, you can open it through a link.
If you have atom installed on your system, here is an example, it will open the program which as I believe is a exe file. This is just a random package I stumble a bond. atom://settings-view/show-package?package=autocomplete-plus
Mahfoud Boukert actually explains this a bit, with some code examples.
At work I'm a PC (bummer - I'm a MAC fanatic) and Firefox. The code that worked for me in Firefox, and the link works internally ONLY, was <a href = "file:///c:/Myfolder/Myprogram.exe">
.
AND it works ONLY if you right click on the link and select Open Link in Ext.App. Just clicking on the link itself prompts the user to save the .exe file and then run it.
I could not get it 2 work in IE or Firefox with just <a href = "c:/Myfolder/Myprogram.exe">
I know a good answer to this one, Roblox and Atom uses this technique to run exe programs with a link.
itch.io is another website that can emulate an .exe file but doesn't require you to download it. Take for example, https://danidev.itch.io/triangle-game, by Dani (a youtuber that i quite like :D). I'm too lazy to dig through file sources but basically, this game was created with Unity. I'm not too sure of this but I think to have an .exe file load on an .html website, you have to use WebGL. (because it was the only option i found when digging through one of Dani's videos that supported exporting a Unity program to HTML5)
Why not use CGI for this purpose, CGI actually runs the executable through browser on server.
Simply provide access to the folder, but do not include the .exe in the href. The user will then just click on the .exe file to open it. Open here where 'targetFolder' holds your .exe file.