HomePage | RecentChanges | Preferences | Newbie Help
Category Other FAQ
- How can I use HTML to launch executable programs?
- How can I start programs from a web page?
- Can I make a link to run a program on the visitor's computer?
In intranets, or instructional materials distributed on CD-ROM, you might be able to launch programs from an HTML browser by using the [Microsoft HTML Applications (HTA)] or the [LaunchInIE ActiveX control].
[Particle Software] offers a commercial solution. It does everything, including [running applications from a specific CD-ROM regardless of its drive letter].
Here's my particular response to this sort of stupid question (only when it's asked in relation to the web, obviously). From Secrets of the 1337 (no proper location for it yet, so I've put the whole thing here):
(It should be noted, as a disproportionally high number of people fail to work this out for themselves, that the following includes a large amount of sarcasm. -- David Dorward)
- Q: How do I force the user's browser to run an executable file of my choosing from their browser, without any of that hysterical-yet-boring "warning! executing a file is very dangerous! you should save it then scan it before running it!" crap?
- A: We in the web design world like to say that this is impossible, that this is dangerous, that this is at least vaguely Republican. To be perfectly honest, it's all scare-mongering. It's incredibly easy to force the user to run a file (especially if they use Microsh!t Internet Exploder). Yes, even files like C:\format.com! Here's how.
- Okay, this is an ordinary link:
- <a href="http://www.example.net/bar/virus.exe" title="virus via foobar">foobar virus</a>
- Now, this sort of link will (unfortunately) pop up the "would you like to open or save this file?" dialogue in Exploder, Mozarelli and OTemporaOMores . This is, as already established, a bad thing. After all, we wouldn't want the user to realise just how dangerous and stupid it is to run an executable file downloaded from an anonymous site with no clue as to its real function, now do we? What we want to do is give the user the full foobar virus.exe experience, before they've even realised they've turned on their computers, let alone connected to the 'net, waited interminably for IE to load, then clicked on the hyperlink. Fortunately, there's a little-known hack that will allow us to get past this problem. Please, tread carefully and quietly, we are entering the really complex stages of hardcore HTML programming. Observe:
- <a href="http://www.example.net/bar/virus.exe" title="virus via foobar" onclick="run_virus='1'; return true;" prompt="no" security="disable">foobar virus</a>
- Now you can safely force the user to run your virus, er, friendly program without any fear of stupid and unnecessary security measures getting in the way. But why stop there? If you know a little asthmascript , you can adapt the above programming script code into a function that is called by the browser OnLoad, removing from the visitor's control the dreary task of dragging the mouse across the screen to click on one little tiny link.
1. How come my computer still asking for save dialog after i put the link ?
- <a href="c:\winnt\notepad.exe" title="notepad" onclick="run_notepad='1'; return true;" prompt="no" security="disable">Notepad</a>
Hi :-) Please help! I'm trying to launch an exe from the browser (without the open/save prompt!) and used your info in the "How can I use HTML to launch executable programs?", but it doesn' seem to work - Yes, I tried the Notepad link, and still a no go.....I can launch the exe from the cmd line. win2k Thanks! ~~Amy