Вопрос

I have a requirement wherein I need to launch an application (assumed to be installed on the user's machine) from a webpage.

I found that there are several ways of doing so, but I would like to know if this is an acceptable solution. Is it OK to execute applications from a webpage or is this some kind of an anti-pattern?

EDIT: To clarify, I did not mean that the executable will launch on loading the webpage, rather as Florian mentions, it will be on a user click, so the user knows that an executable will be launched. My question was is even this ok?

Это было полезно?

Решение

If you can do this, it is most likely a security flaw. Can you imagine if I run all your applications just because you visited my webpage?

However, you can do something like skype does: adding a protocol that your desktop application handles. This means that when the user will click on the link, it will launch the desktop application handling the protocol.

Skype's links are like this:

<a href="skype://username">Skype me!</a>

And the skype program is the default handler of the skype protocol for your operating system, so it will run it.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top