问题
Is it possible to launch an application from a browser? I am not talking about opening a file from a browser (like open a PDF with Adobe Reader), but rather opening a new (blank) instance of an application that is installed on the user\'s machine.
Hypothetical situation: User browses a website that lists computers that can be managed via RDP. He clicks on a link to 192.168.1.10, that link opens Microsoft RDP client (mstsc.exe) with that ip address already filled out.
I am talking strictly about Windows universe.
Is that thing even doable outside of ActiveX and IE?
Is it wise to attempt this in IE with ActiveX?
回答1:
You can't really "launch an application" in the true sense. You can as you indicated ask the user to open a document (ie a PDF) and windows will attempt to use the default app for that file type. Many applications have a way to do this.
For example you can save RDP connections as a .rdp file. Putting a link on your site to something like this should allow the user to launch right into an RDP session:
<a href="MyServer1.rdp">Server 1</a>
回答2:
We use a sonicwall vpn. It launches a java applet that launches mstc with all the credentials setup. You really can't do this without a java applet or activex plugin.
Microsoft uses this technique itself on their small business server for getting inside the network. I wouldn't say it is a terrible idea, as long as platform independence isn't important.
回答3:
Some applications launches themselves by protocols. like itunes with "itms://" links. I don't know however how you can register that with windows.
回答4:
You can use SilverLight to launch an application from the browser (this will work only on IE and Firefox, newer versions of chrome don't support this)
Example code here
回答5:
I achieved the same thing using a local web server and PHP. I used a script containing shell_exec to launch an application locally.
Alternatively, you could do something like this:
<a href="file://C:/Windows/notepad.exe">Notepad</a>
回答6:
You can use the following:
<a href="c:\windows\Notepad.exe"
type="application/octet-stream">Launch Notepad</a>
From what I remember using file:// is blocked by Chrome and Firefox.
来源:https://stackoverflow.com/questions/3057576/how-to-launch-an-application-from-a-browser