How the Web page invokes the client's executable file
Source: Internet
Author: User
recently, the group is discussing how to open an EXE file from a Web page. In the group inside said the idea, but always say not clear, promised to write an article out. These days things are quite many, have no time to write, let Chiu classmate waiting. browser-based applications, the performance is always not rich enough, we often think, in a Web page, click a link, can directly invoke the installation of the executable program how good AH. According to Microsoft's recommendation, it should be through ActiveX, the executable program embedded in the Web page, such as Flash ActiveX. In this way, we're going to buy an ActiveX signature, not something that's signed, that can't be loaded in IE6, and it's too expensive to buy an ActiveX signature for a small item. Also, there are many times to consider what to do if a user suddenly closes the browser. This has little impact on playing a flash or song, but many times it's not possible to sweep the battlefield before it's closed, and the consequences are disastrous. Generally, in enterprise applications, we always call the EXE directly through IE. at the earliest, it's easy to call an EXE from a Web page, and a piece of JavaScript will do it. But since IE6 began, Microsoft has no longer allowed this "highly unsafe behavior". That makes sense, too. Nothing will give you a "format d:/q", even if not so bad, it is easy to give you play hundreds of notebook, is indeed scary enough. Browsers should not have too many unnecessary associations with the operating system. get JavaScript after the IE6 test, I almost gave up the idea of directly calling EXE until one day I saw the way Tencent was implemented. Tencent has a QQ on the page above the state of things, click on the pop-up can be a dialog box with the QQ users chat, without any warning. It's so amazing. A day in the registry, and finally understand what's going on. in Windows, the registry contains information about various protocols (http,ftp,telnet, and so on), including parameters for the default open mode. Try, enter telnet://www.163.com from IE's Address bar, what appears. A command line window pops up and begins the Telnet operation. IE actually can complete this, then why can't complete "telnet1://parameter". Windows Registry Editor Version5.00 [Hkey_local_machine/software/classes/sims] @= "SIMS" "URL Protocol" = "C://progra~1//sims//trans.exe%l" [Hkey_local_machine/software/classes/sims/defaulticon] @= "%systemroot%//system32//url.dll,0" [HKEY_ Local_machine/software/classes/sims/shell] [Hkey_local_machine/software/classes/sims/shell/open] [ Hkey_local_machine/software/classes/sims/shell/open/command] @= "C://progra~1//sims//trans.exe%l" import this into the registry, then we will automatically call C:/Program files/sims/when we enter sims://1022 in the browser. Trans.exe (Of course, you do have this file) and pass the 1022 parameter to the EXE. This operation is considered safe and does not have any restrictions. here, the idea is clear, our installer, in the registry to build a protocol, such as the above Sims, and then to execute the EXE path information written in the Web page directly a hyperlink, the agreement://Parameters on it. EXE file accepts this parameter, carries on the corresponding processing. Get. Remember, protocol: all strings after//are considered to be a parameter. Then, EXE file is always only two parameters, parameter 0 is its full execution path, parameter 1 is the Web page passed the string
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.