Launch Program from IE

Is it possible to launch a program from an anchor in IE? For example, iTunes had links like itms:blahblah that would open up iTunes and go directly to the appropriate page. If so, what is the best way to do this?

Upvotes: 5

Views: 9027

Answers (2)

Marc Bollinger
Marc Bollinger

Reputation: 3119

Yes, but not without help. Your protocol has to be registered on the user's computer, which can be done via ftype. I'd assume that what you're seeing is the product of the iTunes installer registering itms. If you type ftype itms at the command line, you're likely to get something like itms=C:\Program Files\iTunes\iTunes.exe /url "%1".

That is to say, no, you can't do it just from inside the browser, that would be a terrible, horrible, no-good, very-bad security hole.

Upvotes: 2

Timothy Khouri
Timothy Khouri

Reputation: 31845

If you're talking purely from the browser, you can't register your own "protocol"... the thing is that when you installed iTunes, it registered the itms protocol so that any link that looks like this:

<a href="itms://something.mp3">click me</a>

Would open up the iTunes app. You can't do that (without running your own executable first which registers your custom protocol with the computer), but, what you can do is make a link to a file on our local computer... example:

<a href="file://c:/windows/notepad.exe">Launch Notepad</a>

I, of course, am assuming that you're making a simple HTML page that is meant for your own internal use (or on your companies internal network) to launch known programs from your computer.

Upvotes: 3

Related Questions