Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
195 views
in Technique[技术] by (71.8m points)

windows - How to launch an application from a browser?

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?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The correct method is to register your custom URL Protocol in windows registry as follows:

[HKEY_CLASSES_ROOTcustomurl]
@="Description here"
"URL Protocol"=""

[HKEY_CLASSES_ROOTcustomurlshell]

[HKEY_CLASSES_ROOTcustomurlshellopen]

[HKEY_CLASSES_ROOTcustomurlshellopencommand]
@=""C:\Path To Your EXE\ExeName.exe" "%1""

Once the above keys and values are added, from the web page, just call "customurl:\parameter1=xxx&parameter2=xxx" . You will receive the entire url as the argument in exe, which you need to process inside your exe. Change 'customurl' with the text of your choice.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...